summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Bug.pm
diff options
context:
space:
mode:
authorReed Loden <reed@reedloden.com>2010-04-06 05:19:34 +0200
committerReed Loden <reed@reedloden.com>2010-04-06 05:19:34 +0200
commit6479bb0febd76bad944eb9a012a96cac8d64cd9a (patch)
tree54bc553f9d319dccf0449725e6c29a30b105309f /Bugzilla/Bug.pm
parentd74d76b0730621b09571775902899d7030ca3150 (diff)
downloadbugzilla-6479bb0febd76bad944eb9a012a96cac8d64cd9a.tar.gz
bugzilla-6479bb0febd76bad944eb9a012a96cac8d64cd9a.tar.xz
Bug 532350 - "Can't add Debian bug URLs to a bug using "See Also""
[r=LpSolit r=mkanat a=mkanat]
Diffstat (limited to 'Bugzilla/Bug.pm')
-rw-r--r--Bugzilla/Bug.pm21
1 files changed, 21 insertions, 0 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 0d6a4be17..89e47a70f 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -2443,6 +2443,27 @@ sub add_see_also {
$result = "http://code.google.com/p/" . $project_name .
"/issues/detail?id=" . $bug_id;
}
+ # Debian BTS URLs
+ elsif ($uri->authority =~ /^bugs.debian.org$/i) {
+ # Debian BTS URLs can look like various things:
+ # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1234
+ # http://bugs.debian.org/1234
+ my $bug_id;
+ if ($uri->path =~ m|^/(\d+)$|) {
+ $bug_id = $1;
+ }
+ elsif ($uri->path =~ /bugreport\.cgi$/) {
+ $bug_id = $uri->query_param('bug');
+ detaint_natural($bug_id);
+ }
+ if (!$bug_id) {
+ ThrowUserError('bug_url_invalid',
+ { url => $input, reason => 'id' });
+ }
+ # This is the shortest standard URL form for Debian BTS URLs,
+ # and so we reduce all URLs to this.
+ $result = "http://bugs.debian.org/" . $bug_id;
+ }
# Bugzilla URLs
else {
if ($uri->path !~ /show_bug\.cgi$/) {