Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
b3c471ca
Commit
b3c471ca
authored
Jan 26, 2009
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 474902: Allow the Bug URL (See Also) field to also accept Launchpad bug URLs
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=dkl, a=mkanat
parent
503f732b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
24 deletions
+47
-24
Bug.pm
Bugzilla/Bug.pm
+41
-19
Bug.pm
Bugzilla/WebService/Bug.pm
+6
-5
No files found.
Bugzilla/Bug.pm
View file @
b3c471ca
...
...
@@ -2366,25 +2366,47 @@ sub add_see_also {
ThrowUserError
(
'bug_url_invalid'
,
{
url
=>
$input
,
reason
=>
'http'
});
}
if
(
$uri
->
path
!~
/show_bug\.cgi$/
)
{
ThrowUserError
(
'bug_url_invalid'
,
{
url
=>
$input
,
reason
=>
'show_bug'
});
}
my
$bug_id
=
$uri
->
query_param
(
'id'
);
# We don't currently allow aliases, because we can't check to see
# if somebody's putting both an alias link and a numeric ID link.
# When we start validating the URL by accessing the other Bugzilla,
# we can allow aliases.
detaint_natural
(
$bug_id
);
if
(
!
$bug_id
)
{
ThrowUserError
(
'bug_url_invalid'
,
{
url
=>
$input
,
reason
=>
'id'
});
}
# Make sure that "id" is the only query parameter.
$uri
->
query
(
"id=$bug_id"
);
# And remove any # part if there is one.
$uri
->
fragment
(
undef
);
my
$result
=
$uri
->
canonical
->
as_string
;
my
$result
;
# Launchpad URLs
if
(
$uri
->
authority
=~
/launchpad.net$/
)
{
# Launchpad bug URLs can look like various things:
# https://bugs.launchpad.net/ubuntu/+bug/1234
# https://launchpad.net/bugs/1234
# All variations end with either "/bugs/1234" or "/+bug/1234"
if
(
$uri
->
path
=~
m
|
bugs
?
/
(
\
d
+
)
$|
)
{
# This is the shortest standard URL form for Launchpad bugs,
# and so we reduce all URLs to this.
$result
=
"https://launchpad.net/bugs/$1"
;
}
else
{
ThrowUserError
(
'bug_url_invalid'
,
{
url
=>
$input
,
reason
=>
'id'
});
}
}
# Bugzilla URLs
else
{
if
(
$uri
->
path
!~
/show_bug\.cgi$/
)
{
ThrowUserError
(
'bug_url_invalid'
,
{
url
=>
$input
,
reason
=>
'show_bug'
});
}
my
$bug_id
=
$uri
->
query_param
(
'id'
);
# We don't currently allow aliases, because we can't check to see
# if somebody's putting both an alias link and a numeric ID link.
# When we start validating the URL by accessing the other Bugzilla,
# we can allow aliases.
detaint_natural
(
$bug_id
);
if
(
!
$bug_id
)
{
ThrowUserError
(
'bug_url_invalid'
,
{
url
=>
$input
,
reason
=>
'id'
});
}
# Make sure that "id" is the only query parameter.
$uri
->
query
(
"id=$bug_id"
);
# And remove any # part if there is one.
$uri
->
fragment
(
undef
);
$result
=
$uri
->
canonical
->
as_string
;
}
if
(
length
(
$result
)
>
MAX_BUG_URL_LENGTH
)
{
ThrowUserError
(
'bug_url_too_long'
,
{
url
=>
$result
});
...
...
Bugzilla/WebService/Bug.pm
View file @
b3c471ca
...
...
@@ -1321,7 +1321,7 @@ B<UNSTABLE>
=item B<Description>
Adds or removes URLs for the "See Also" field on bugs. These URLs must
point to some valid bug in some Bugzilla installation.
point to some valid bug in some Bugzilla installation
or in Launchpad
.
=item B<Params>
...
...
@@ -1335,10 +1335,11 @@ to modify.
=item C<add>
Array of C<string>s. URLs to Bugzilla bugs. These URLs will be added to
the See Also field. They must be valid URLs to C<show_bug.cgi> in a
Bugzilla installation. If they don't start with C<http://> or C<https://>,
it will be assumed that C<http://> should be added to the beginning of the
string.
the See Also field. They must be valid URLs to C<show_bug.cgi> in a
Bugzilla installation or to a bug filed at launchpad.net.
If the URLs don't start with C<http://> or C<https://>, it will be assumed
that C<http://> should be added to the beginning of the string.
It is safe to specify URLs that are already in the "See Also" field on
a bug--they will just be silently ignored.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment