Putting comment url in "See Also" strips out the fragment part

NEW
Unassigned

Status

()

Bugzilla
Creating/Changing Bugs
--
enhancement
3 years ago
3 years ago

People

(Reporter: xidorn, Unassigned)

Tracking

Details

For example, if I put a comment url like:
https://bugzilla.mozilla.org/show_bug.cgi?id=1140623#c17
in the "See Also" field, the hash part #c17 will be stripped out, and the url in See Also becomes
https://bugzilla.mozilla.org/show_bug.cgi?id=1140623
Assignee: nobody → create-and-change
Component: General → Creating/Changing Bugs
Product: bugzilla.mozilla.org → Bugzilla
QA Contact: default-qa
Version: Production → unspecified

Comment 1

3 years ago
Our code intentionally removes fragments from URLs, so this is so by design. For instance for Bugzilla URLs:

    # 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);
Severity: normal → enhancement
(In reply to Frédéric Buclin from comment #1)
> Our code intentionally removes fragments from URLs, so this is so by design.
> For instance for Bugzilla URLs:
> 
>     # 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);

But sometimes we do want to refer to a comment instead of the bug. Would there be any solution for that case?
What is the reasoning behind removing the fragment from the see-also URL?

Comment 4

3 years ago
(In reply to Dylan William Hardison [:dylan] from comment #3)
> What is the reasoning behind removing the fragment from the see-also URL?

Honestly, I have no idea as this question has never been asked in the original bugs and I wasn't involved in the implementation of the See Also field. My guess is that we want to totally control the format of the URL, and fragments could be any random string. I have no strong opinion on this, but I suppose they could make sense when you want to point to some specific place in a bug report. Note that validators in the MoreBugUrl extension also remove fragments, so at least there is some consistency. :)
Perhaps the right solution is to make a #c optional in MoreBugUrl? I'll take a look at the code.

Comment 6

3 years ago
(In reply to Dylan William Hardison [:dylan] from comment #5)
> Perhaps the right solution is to make a #c optional in MoreBugUrl? I'll take
> a look at the code.

But then why not accept #attach_NNN too, which is legal in Bugzilla? And why accepting #foo for some URLs but not for others? Each validator has its own rules, and not all comments are of the form #foo. I'm not saying this shouldn't be fixed (I'm not saying this should be fixed either), I just wanted to say that there isn't one single format to point to comments across bug tracking systems.
Summary: Putting comment url in "See Also" strips out the hash part → Putting comment url in "See Also" strips out the fragment part
You need to log in before you can comment on or make changes to this bug.