summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Bug.pm
diff options
context:
space:
mode:
authorReed Loden <reed@reedloden.com>2010-03-30 03:01:45 +0200
committerReed Loden <reed@reedloden.com>2010-03-30 03:01:45 +0200
commit64ac9b3338c40d88fb1517f259e5f8313553d646 (patch)
treeed4bbf7b57c21697e044d7f34ad6d821faa16eb2 /Bugzilla/Bug.pm
parent861cae72a4b21dee95c716db4076c7aa78932f75 (diff)
downloadbugzilla-64ac9b3338c40d88fb1517f259e5f8313553d646.tar.gz
bugzilla-64ac9b3338c40d88fb1517f259e5f8313553d646.tar.xz
Bug 533121 - "Support Google Code for see_also urls"
[r=LpSolit a=mkanat]
Diffstat (limited to 'Bugzilla/Bug.pm')
-rw-r--r--Bugzilla/Bug.pm22
1 files changed, 22 insertions, 0 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index c7c168125..2ce292edb 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -2422,6 +2422,28 @@ sub add_see_also {
{ url => $input, reason => 'id' });
}
}
+ # Google Code URLs
+ elsif ($uri->authority =~ /^code.google.com$/) {
+ # Google Code URLs only have one form:
+ # http(s)://code.google.com/p/PROJECT_NAME/issues/detail?id=1234
+ my $project_name;
+ if ($uri->path =~ m|^/p/([^/]+)/issues/detail$|) {
+ $project_name = $1;
+ } else {
+ ThrowUserError('bug_url_invalid',
+ { url => $input });
+ }
+ my $bug_id = $uri->query_param('id');
+ detaint_natural($bug_id);
+ if (!$bug_id) {
+ ThrowUserError('bug_url_invalid',
+ { url => $input, reason => 'id' });
+ }
+ # While Google Code URLs can be either HTTP or HTTPS,
+ # always go with the HTTP scheme, as that's the default.
+ $result = "http://code.google.com/p/" . $project_name .
+ "/issues/detail?id=" . $bug_id;
+ }
# Bugzilla URLs
else {
if ($uri->path !~ /show_bug\.cgi$/) {