This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/9178 Change subject: redmine: Change content-disposition of image attachments to 'inline' ...................................................................... redmine: Change content-disposition of image attachments to 'inline' Closes: OS#3264 Change-Id: Ib60a12fc4adc0ceebfed70ff14d5ae256868bb2b --- M redmine/Dockerfile A redmine/redmine-image-content-disposition.diff 2 files changed, 67 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/docker-playground refs/changes/78/9178/1 diff --git a/redmine/Dockerfile b/redmine/Dockerfile index 81976c6..1d8362d 100644 --- a/redmine/Dockerfile +++ b/redmine/Dockerfile @@ -12,3 +12,6 @@ COPY redmine-openid-hmac-digest.diff /tmp/ RUN cd /usr/local/bundle/gems/ruby-openid-2.3.0 && patch -p0 < /tmp/redmine-openid-hmac-digest.diff + +COPY redmine-image-content-disposition.diff /tmp/ +RUN patch -p1 < /tmp/redmine-image-content-disposition.diff diff --git a/redmine/redmine-image-content-disposition.diff b/redmine/redmine-image-content-disposition.diff new file mode 100644 index 0000000..50d83db --- /dev/null +++ b/redmine/redmine-image-content-disposition.diff @@ -0,0 +1,64 @@ +From 6c94d485cb3e23559da8f0356a1052a620d7a2c2 Mon Sep 17 00:00:00 2001 +From: Harald Welte <laforge at gnumonks.org> +Date: Mon, 14 May 2018 23:16:51 +0200 +Subject: [PATCH] chagnge content-disposition of pdf/image/text/patch to + 'inline' + +Related: https://osmocom.org/issues/3264 +--- + app/controllers/attachments_controller.rb | 9 ++++++++- + app/models/attachment.rb | 8 ++++++++ + 2 files changed, 16 insertions(+), 1 deletion(-) + +diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb +index c2b5fa9c8..f2a57c31d 100644 +--- a/app/controllers/attachments_controller.rb ++++ b/app/controllers/attachments_controller.rb +@@ -57,7 +57,7 @@ class AttachmentsController < ApplicationController + # images are sent inline + send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), + :type => detect_content_type(@attachment), +- :disposition => 'attachment' ++ :disposition => disposition(@attachment) + end + end + +@@ -188,4 +188,12 @@ class AttachmentsController < ApplicationController + end + content_type.to_s + end ++ ++ def disposition(attachment) ++ if attachment.is_pdf? || attachment.is_image? || attachment.is_diff? || attachment.is_text? ++ 'inline' ++ else ++ 'attachment' ++ end ++ end + end +diff --git a/app/models/attachment.rb b/app/models/attachment.rb +index 3d16f57cc..a2520b0d5 100644 +--- a/app/models/attachment.rb ++++ b/app/models/attachment.rb +@@ -236,10 +236,18 @@ class Attachment < ActiveRecord::Base + Redmine::MimeType.is_type?('text', filename) + end + ++ def is_image? ++ Redmine::MimeType.is_type?('image', filename) ++ end ++ + def is_diff? + self.filename =~ /\.(patch|diff)$/i + end + ++ def is_pdf? ++ Redmine::MimeType.of(filename) == "application/pdf" ++ end ++ + # Returns true if the file is readable + def readable? + File.readable?(diskfile) +-- +2.17.0 + -- To view, visit https://gerrit.osmocom.org/9178 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Ib60a12fc4adc0ceebfed70ff14d5ae256868bb2b Gerrit-Change-Number: 9178 Gerrit-PatchSet: 1 Gerrit-Owner: Harald Welte <laforge at gnumonks.org> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180515/9f1c4d8b/attachment.htm>