summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-09-19 01:51:41 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-09-19 01:51:41 +0200
commitf3043f8c50fc3fbaac43d8e577c515008b790153 (patch)
treea3fbafa9c1cf4e48e417db73a0216e5fe834652e
parentb7777aee805f87b50d37977d2ce497d32cf32864 (diff)
downloadbugzilla-f3043f8c50fc3fbaac43d8e577c515008b790153.tar.gz
bugzilla-f3043f8c50fc3fbaac43d8e577c515008b790153.tar.xz
Bug 593173: Make See Also recognize both "http" and "https" links for local
bugs as being the same bug. r=timello, a=mkanat
-rw-r--r--Bugzilla/Bug.pm16
1 files changed, 11 insertions, 5 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index a8f6651e0..ea84fddf5 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -2906,11 +2906,17 @@ sub add_see_also {
$uri->query("id=$bug_id");
# And remove any # part if there is one.
$uri->fragment(undef);
- $result = $uri->canonical->as_string;
-
- # See Also field of the referenced bug is updated
- # to point to the current bug.
- if ($result =~ m/^\Q$local_bug_uri\E/ and !$skip_recursion) {
+ my $uri_canonical = $uri->canonical;
+ $result = $uri_canonical->as_string;
+
+ # If this is a link to a local bug (treating the domain
+ # case-insensitively and ignoring http(s)://), then also update
+ # the other bug to point at this one.
+ my $canonical_local = URI->new($local_bug_uri)->canonical;
+ if (!$skip_recursion
+ and $canonical_local->authority eq $uri_canonical->authority
+ and $canonical_local->path eq $uri_canonical->path)
+ {
my $ref_bug = Bugzilla::Bug->check($bug_id);
if ($ref_bug->id == $self->id) {
ThrowUserError('see_also_self_reference');