From: Reed Loden Date: Tue, 30 Mar 2010 01:02:47 +0000 (-0500) Subject: Bug 533121 - "Support Google Code for see_also urls" X-Git-Tag: bugzilla-3.6~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5a089696133fd39aa496185614e0ddf659d3807;p=thirdparty%2Fbugzilla.git Bug 533121 - "Support Google Code for see_also urls" [r=LpSolit a=mkanat] --- diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index f41a242f95..6336dbcbc1 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -2400,6 +2400,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$/) {