From f4ce0ddde44c278af9c7a9f198c9893d7db7472d Mon Sep 17 00:00:00 2001 From: Douwe Maan <douwe@gitlab.com> Date: Wed, 4 Feb 2015 15:35:10 +0100 Subject: [PATCH] Show image attachments in browser instead of downloading them. Resolves #1702. --- app/controllers/files_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 7937454810d..9671245d3f4 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -5,7 +5,8 @@ class FilesController < ApplicationController if uploader.file_storage? if can?(current_user, :read_project, note.project) - send_file uploader.file.path, disposition: 'attachment' + disposition = uploader.image? ? 'inline' : 'attachment' + send_file uploader.file.path, disposition: disposition else not_found! end -- GitLab