Bug 533121 - "Support Google Code for see_also urls"

[r=LpSolit a=mkanat]


git-svn-id: svn://10.0.0.236/branches/BUGZILLA-3_6-BRANCH@260099 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mkanat%bugzilla.org 2010-03-30 01:17:46 +00:00
parent 4f72d29310
commit 6d25097a9e
2 changed files with 23 additions and 1 deletions

View File

@ -1 +1 @@
7060
7061

View File

@ -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$/) {