Uploaded image for project: 'MusicBrainz Server'
  1. MusicBrainz Server
  2. MBS-13967

URL fragments are escaped by doc_link TT macro

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • None
    • Documentation
    • None

      The doc_link Template Toolkit macro looks like it percent-encodes # characters in supplied paths, resulting in hash/fragment URLs not working properly.

      To demonstrate, if you credit a track to the Various Artists SPA, the displayed warning links to https://musicbrainz.org/doc/Style/Unknown_and_untitled/Special_purpose_artist%23List_of_official_SPAs rather than the intended https://musicbrainz.org/doc/Style/Unknown_and_untitled/Special_purpose_artist#List_of_official_SPAs. The latter URL jumps to the expected heading in the page, while the former remains scrolled to the top and additionally displays a weird "Special purpose artist#List of official SPAs" title instead of the actual "Special purpose artist" title.

      root/release/edit/tracklist.tt calls the va_doc_link macro, which calls doc_link('Style/Unknown_and_untitled/Special_purpose_artist#List_of_official_SPAs'). doc_link calls c.uri_for('/doc', to).

      I don't know anything about Catalyst, but my interpretation of the comment at https://github.com/perl-catalyst/catalyst-runtime/blob/1d40b8ea5a7f4a4ae99af921b914f04e7c9a21c3/lib/Catalyst.pm#L1569 is that this should work and that the fragment shouldn't be escaped, so I'm not sure where things are going wrong.

      Edit: On second thought, that comment is maybe saying that only the first string arg (i.e. /doc) won't be escaped.

            derat derat
            derat derat
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                Version Package