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)

4.1.3
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: LpSolit, Assigned: timello)

References

Details

Attachments

(1 file, 1 obsolete file)

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+
Attached patch v1 (obsolete) — Splinter Review
It should be removed.
Assignee: create-and-change → timello
Status: NEW → ASSIGNED
Attachment #560929 - Flags: review?(LpSolit)
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-
Attached patch v2Splinter Review
Now it should handle just bug ids and local Bugzilla urls.
Attachment #560929 - Attachment is obsolete: true
Attachment #561027 - Flags: review?(LpSolit)
s/just//
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+
Flags: approval4.2+
Flags: approval+
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.

Attachment

General

Created:
Updated:
Size: