summaryrefslogtreecommitdiffstats
path: root/attachment.cgi
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-10-15 18:40:18 +0200
committerByron Jones <bjones@mozilla.com>2013-10-15 18:40:18 +0200
commita3841dfd8f9fc019eda1ccf57c91b7305cef1c7e (patch)
tree9b5124365c8f6ce5c4730db2081d880660ba0f32 /attachment.cgi
parent46ab4b8a85d62bc7b06c1d84c5e9553f9fade0ae (diff)
downloadbugzilla-a3841dfd8f9fc019eda1ccf57c91b7305cef1c7e.tar.gz
bugzilla-a3841dfd8f9fc019eda1ccf57c91b7305cef1c7e.tar.xz
Bug 916906: attaching a file which just contains a github url should automatically redirect to it when viewing
Diffstat (limited to 'attachment.cgi')
-rwxr-xr-xattachment.cgi4
1 files changed, 4 insertions, 0 deletions
diff --git a/attachment.cgi b/attachment.cgi
index 350cf91f1..95d793e75 100755
--- a/attachment.cgi
+++ b/attachment.cgi
@@ -52,6 +52,7 @@ use Bugzilla::Attachment;
use Bugzilla::Attachment::PatchReader;
use Bugzilla::Token;
use Bugzilla::Keyword;
+use Bugzilla::Hook;
use Encode qw(encode find_encoding);
@@ -386,6 +387,9 @@ sub view {
# Return the appropriate HTTP response headers.
$attachment->datasize || ThrowUserError("attachment_removed");
+ # BMO add a hook for github url redirection
+ Bugzilla::Hook::process('attachment_view', { attachment => $attachment });
+
$filename =~ s/^.*[\/\\]//;
# escape quotes and backslashes in the filename, per RFCs 2045/822
$filename =~ s/\\/\\\\/g; # escape backslashes