Closed
Bug 686967
Opened 13 years ago
Closed 13 years ago
Incoherent code in Bugzilla::BugUrl::Bugzilla::Local->should_handle()
Categories
(Bugzilla :: Creating/Changing Bugs, defect)
Tracking
()
RESOLVED
FIXED
Bugzilla 4.2
People
(Reporter: LpSolit, Assigned: timello)
References
Details
Attachments
(1 file, 1 obsolete file)
1.05 KB,
patch
|
LpSolit
:
review+
|
Details | Diff | Splinter Review |
Found in Bugzilla::BugUrl::Bugzilla::Local:
sub should_handle {
my ($class, $uri) = @_;
return $uri->as_string =~ m/^\w+$/ ? 1 : 0;
my $canonical_local = URI->new($class->local_uri)->canonical;
# Treating the domain case-insensitively and ignoring http(s)://
return ($canonical_local->authority eq $uri->canonical->authority
and $canonical_local->path eq $uri->canonical->path) ? 1 : 0;
}
Tell me how we are supposed to reach the code after the first return? :) Either the last part of the method is useless and should be removed, or the first return shouldn't be called unconditionally.
Flags: blocking4.2+
Assignee | ||
Comment 1•13 years ago
|
||
It should be removed.
Assignee: create-and-change → timello
Status: NEW → ASSIGNED
Attachment #560929 -
Flags: review?(LpSolit)
Reporter | ||
Comment 2•13 years ago
|
||
Comment on attachment 560929 [details] [diff] [review]
v1
> sub should_handle {
> my ($class, $uri) = @_;
>-
> return $uri->as_string =~ m/^\w+$/ ? 1 : 0;
>-
>- my $canonical_local = URI->new($class->local_uri)->canonical;
>-
>- # Treating the domain case-insensitively and ignoring http(s)://
>- return ($canonical_local->authority eq $uri->canonical->authority
>- and $canonical_local->path eq $uri->canonical->path) ? 1 : 0;
> }
As I understand it, a local bug is detected either because it matches /^\w+$/, or because it comes from the same urlbase as the local Bugzilla installation. This means we want to return early on if $uri->as_string =~ m/^\w+$/. Otherwise the 2nd check is still needed.
Attachment #560929 -
Flags: review?(LpSolit) → review-
Assignee | ||
Comment 3•13 years ago
|
||
Now it should handle just bug ids and local Bugzilla urls.
Attachment #560929 -
Attachment is obsolete: true
Attachment #561027 -
Flags: review?(LpSolit)
Assignee | ||
Comment 4•13 years ago
|
||
s/just//
Reporter | ||
Comment 5•13 years ago
|
||
Comment on attachment 561027 [details] [diff] [review]
v2
Works fine. r=LpSolit
I just realized that when you add a local bug ID, the history of the other bug is not updated; only the current bug history is.
I will file a separate bug for that.
Attachment #561027 -
Flags: review?(LpSolit) → review+
Reporter | ||
Updated•13 years ago
|
Flags: approval4.2+
Flags: approval+
Assignee | ||
Comment 6•13 years ago
|
||
Committing to: bzr+ssh://timello%40gmail.com@bzr.mozilla.org/bugzilla/4.2/
modified Bugzilla/BugUrl/Bugzilla/Local.pm
Committed revision 7934.
Committing to: bzr+ssh://timello%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/BugUrl/Bugzilla/Local.pm
Committed revision 7966.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•