summaryrefslogtreecommitdiffstats
path: root/showattachment.cgi
diff options
context:
space:
mode:
authormyk%mozilla.org <>2002-01-30 23:14:10 +0100
committermyk%mozilla.org <>2002-01-30 23:14:10 +0100
commit429456196dd7ce8ef7e0876b7e57cdc394a228ba (patch)
tree9822db1683ca3910e53f3a4b3e3d7501ae8f8b42 /showattachment.cgi
parent9704bcdf20dfc01b491d4a7c76f469c9a6190685 (diff)
downloadbugzilla-429456196dd7ce8ef7e0876b7e57cdc394a228ba.tar.gz
bugzilla-429456196dd7ce8ef7e0876b7e57cdc394a228ba.tar.xz
Fix for bug 104521: Removes old attachment interface in favor of new attachment tracker.
Patch by Myk Melez <myk@mozilla.org>. r=bbaetz,kiko
Diffstat (limited to 'showattachment.cgi')
-rwxr-xr-xshowattachment.cgi43
1 files changed, 7 insertions, 36 deletions
diff --git a/showattachment.cgi b/showattachment.cgi
index 70f5c6d66..4aaf6f17d 100755
--- a/showattachment.cgi
+++ b/showattachment.cgi
@@ -28,39 +28,10 @@ use lib qw(.);
require "CGI.pl";
-if (!defined $::FORM{'attach_id'}) {
- print "Content-type: text/html\n";
- print "\n";
- PutHeader("Search by attachment number");
- print "<FORM METHOD=GET ACTION=\"showattachment.cgi\">\n";
- print "You may view a single attachment by entering its id here: \n";
- print "<INPUT NAME=attach_id>\n";
- print "<INPUT TYPE=\"submit\" VALUE=\"Show Me This Attachment\">\n";
- print "</FORM>\n";
- PutFooter();
- exit;
-}
-
-ConnectToDatabase();
-
-quietly_check_login();
-
-if (!detaint_natural($::FORM{attach_id})) {
- DisplayError("Attachment ID should be numeric.");
- exit;
-}
-
-SendSQL("select bug_id, mimetype, thedata from attachments where attach_id = $::FORM{'attach_id'}");
-my ($bug_id, $mimetype, $thedata) = FetchSQLData();
-
-if (!$bug_id) {
- DisplayError("Attachment $::FORM{attach_id} does not exist.");
- exit;
-}
-
-# Make sure the user can see the bug to which this file is attached
-ValidateBugID($bug_id);
-
-print qq{Content-type: $mimetype\n\n$thedata};
-
-
+# Redirect to the new interface for displaying attachments.
+detaint_natural($::FORM{'attach_id'}) if defined($::FORM{'attach_id'});
+my $id = $::FORM{'attach_id'} || "";
+print "Status: 301 Permanent Redirect\n";
+print "Location: attachment.cgi?id=$id&action=view\n\n";
+exit;
+