summaryrefslogtreecommitdiffstats
path: root/extensions/BMO/lib/Data.pm
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-03-24 04:18:45 +0100
committerDylan William Hardison <dylan@hardison.net>2017-03-24 04:19:06 +0100
commit0abf244f409fd91120d35beb65ee4f3a03139a44 (patch)
tree42e3435115aea6da353b5ffb8589ed12c9768c33 /extensions/BMO/lib/Data.pm
parent03d25686135afdd93c33e26f6a2532bcfdf023c9 (diff)
downloadbugzilla-0abf244f409fd91120d35beb65ee4f3a03139a44.tar.gz
bugzilla-0abf244f409fd91120d35beb65ee4f3a03139a44.tar.xz
Bug 1349899 - Clean up invalid mozreview urls on attachment page
Diffstat (limited to 'extensions/BMO/lib/Data.pm')
-rw-r--r--extensions/BMO/lib/Data.pm18
1 files changed, 17 insertions, 1 deletions
diff --git a/extensions/BMO/lib/Data.pm b/extensions/BMO/lib/Data.pm
index 5b07ce645..fcb96a558 100644
--- a/extensions/BMO/lib/Data.pm
+++ b/extensions/BMO/lib/Data.pm
@@ -26,6 +26,22 @@ our @EXPORT = qw( $cf_visible_in_products
# Creating an attachment whose contents is a URL matching one of these regexes
# will result in the user being redirected to that URL when viewing the
# attachment.
+
+my $mozreview_url_re = qr{
+ # begins with mozreview hostname
+ ^
+ https?://reviewboard(?:-dev)?\.(?:allizom|mozilla)\.org
+
+ # followed by a review path
+ /r/\d+
+
+ # ends with optional suffix
+ (?: /
+ | /diff/\#index_header
+ )?
+ $
+}ix;
+
our %autodetect_attach_urls = (
github_pr => {
title => 'GitHub Pull Request',
@@ -35,7 +51,7 @@ our %autodetect_attach_urls = (
},
reviewboard => {
title => 'MozReview',
- regex => qr#^https?://reviewboard(?:-dev)?\.(?:allizom|mozilla)\.org/r/\d+/?#i,
+ regex => $mozreview_url_re,
content_type => 'text/x-review-board-request',
can_review => 1,
},