summaryrefslogtreecommitdiff
path: root/app/controllers/projects/tree_controller.rb
blob: 4d033b368482ccda9a083686107e816fad732692 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Controller for viewing a repository's file structure
class Projects::TreeController < Projects::BaseTreeController
  def show

    if tree.entries.empty?
      if @repository.blob_at(@commit.id, @path)
        redirect_to project_blob_path(@project, File.join(@ref, @path)) and return
      else
        return not_found!
      end
    end

    respond_to do |format|
      format.html
      # Disable cache so browser history works
      format.js { no_cache_headers }
    end
  end
end