diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2018-08-30 15:34:41 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-08-30 15:34:41 +0300 |
commit | edb5759caf8c328803fdc04e3ae520d234edfcfc (patch) | |
tree | e73ba9b241027664a1e27d5778cbd18c0e5a9434 /app/controllers/projects/raw_controller.rb | |
parent | b8856d662942f54d7353e69505be08deb9b1d575 (diff) |
Fixed project logo when it is LFS tracked
Diffstat (limited to 'app/controllers/projects/raw_controller.rb')
-rw-r--r-- | app/controllers/projects/raw_controller.rb | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/app/controllers/projects/raw_controller.rb b/app/controllers/projects/raw_controller.rb index 1cba0011304..91cf35bc70b 100644 --- a/app/controllers/projects/raw_controller.rb +++ b/app/controllers/projects/raw_controller.rb @@ -1,8 +1,7 @@ # Controller for viewing a file's raw class Projects::RawController < Projects::ApplicationController include ExtractsPath - include BlobHelper - include SendFileUpload + include SendsBlob before_action :require_non_empty_project before_action :assign_ref_vars @@ -10,39 +9,7 @@ class Projects::RawController < Projects::ApplicationController def show @blob = @repository.blob_at(@commit.id, @path) - if @blob - headers['X-Content-Type-Options'] = 'nosniff' - return if cached_blob? - - if @blob.stored_externally? - send_lfs_object - else - send_git_blob @repository, @blob, inline: (params[:inline] != 'false') - end - else - render_404 - end - end - - private - - def send_lfs_object - lfs_object = find_lfs_object - - if lfs_object && lfs_object.project_allowed_access?(@project) - send_upload(lfs_object.file, attachment: @blob.name) - else - render_404 - end - end - - def find_lfs_object - lfs_object = LfsObject.find_by_oid(@blob.lfs_oid) - if lfs_object && lfs_object.file.exists? - lfs_object - else - nil - end + send_blob(@blob, inline: (params[:inline] != 'false')) end end |