summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkiko%async.com.br <>2003-10-29 10:58:13 +0100
committerkiko%async.com.br <>2003-10-29 10:58:13 +0100
commit376c76bd00d1eefd68c1013bf43cb6cbb3be653b (patch)
treeb6041d60e2025f82f7726eca1efb6a8a42f16c20
parent77c68c2b1b263007be02930b919cb1b12644c0eb (diff)
downloadbugzilla-376c76bd00d1eefd68c1013bf43cb6cbb3be653b.tar.gz
bugzilla-376c76bd00d1eefd68c1013bf43cb6cbb3be653b.tar.xz
Fix for bug 111522: Provide ability to specify MIME type of attachment
when downloading. Adds a 'ctype' argument to attachment.cgi which allows one to override the content-type when viewing an attachment. Original patch by Alex Vincent <ajvincent@juno.com>; I changed it a tiny bit. r=kiko, myk. a=justdave.
-rwxr-xr-xattachment.cgi10
1 files changed, 10 insertions, 0 deletions
diff --git a/attachment.cgi b/attachment.cgi
index d020b4f57..1f855d367 100755
--- a/attachment.cgi
+++ b/attachment.cgi
@@ -22,6 +22,7 @@
# Myk Melez <myk@mozilla.org>
# Daniel Raichle <draichle@gmx.net>
# Dave Miller <justdave@syndicomm.com>
+# Alexander J. Vincent <ajvincent@juno.com>
################################################################################
# Script Initialization
@@ -433,6 +434,15 @@ sub view
# Retrieve the attachment content and its content type from the database.
SendSQL("SELECT mimetype, filename, thedata FROM attachments WHERE attach_id = $::FORM{'id'}");
my ($contenttype, $filename, $thedata) = FetchSQLData();
+
+ # Bug 111522: allow overriding content-type manually in the posted $::FORM.
+ if ($::FORM{'ctype'})
+ {
+ $::FORM{'contenttypemethod'} = 'manual';
+ $::FORM{'contenttypeentry'} = $::FORM{'ctype'};
+ validateContentType();
+ $contenttype = $::FORM{'ctype'};
+ }
# Return the appropriate HTTP response headers.
$filename =~ s/^.*[\/\\]//;