jenkins-bot has submitted this change and it was merged. Change subject: Add ?download parameter to images ......................................................................
Add ?download parameter to images This parameter triggers Content-Disposition: Attachment which makes the browser download the image instead of displaying it. This is needed by Media Viewer to allow users to click a button in order to download an image. Change-Id: Ia8e15fd3f731b0b85e6985f5adaafeb6d8c32990 Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/385 --- M puppet/manifests/roles/multimediaviewer.pp M puppet/modules/apache/manifests/mods.pp A puppet/templates/content_disposition_attachment.conf.erb 3 files changed, 17 insertions(+), 0 deletions(-) Approvals: BryanDavis: Looks good to me, approved MaxSem: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/puppet/manifests/roles/multimediaviewer.pp b/puppet/manifests/roles/multimediaviewer.pp index 205aa8e..5a271ba 100644 --- a/puppet/manifests/roles/multimediaviewer.pp +++ b/puppet/manifests/roles/multimediaviewer.pp @@ -5,7 +5,13 @@ class role::multimediaviewer { include role::mediawiki include role::multimedia + include ::apache::mods::headers mediawiki::extension { 'MultimediaViewer': } + + apache::conf { 'Content-Disposition: attachment on ?download': + site => $mediawiki::wiki_name, + content => template('content_disposition_attachment.conf.erb'), + } } diff --git a/puppet/modules/apache/manifests/mods.pp b/puppet/modules/apache/manifests/mods.pp index cbfee2e..e27d421 100644 --- a/puppet/modules/apache/manifests/mods.pp +++ b/puppet/modules/apache/manifests/mods.pp @@ -34,3 +34,8 @@ class apache::mods::actions { apache::mod { 'actions': } } + +# mod_headers +class apache::mods::headers { + apache::mod { 'headers': } +} \ No newline at end of file diff --git a/puppet/templates/content_disposition_attachment.conf.erb b/puppet/templates/content_disposition_attachment.conf.erb new file mode 100644 index 0000000..07e2fb4 --- /dev/null +++ b/puppet/templates/content_disposition_attachment.conf.erb @@ -0,0 +1,6 @@ +RewriteEngine On + +RewriteCond %{REQUEST_URI} ^/images.* +RewriteCond %{QUERY_STRING} ^download$ +RewriteRule .* - [E=DOWNLOAD:yes] +Header set "Content-Disposition" "attachment" env=DOWNLOAD \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/120614 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia8e15fd3f731b0b85e6985f5adaafeb6d8c32990 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/vagrant Gerrit-Branch: master Gerrit-Owner: Gilles <gdu...@wikimedia.org> Gerrit-Reviewer: BryanDavis <bda...@wikimedia.org> Gerrit-Reviewer: Gilles <gdu...@wikimedia.org> Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com> Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits