Page MenuHomePhabricator

Links in report are not URL encoded
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Go to this report
  • Try opening the reported page by clicking on Draft:Why do bees build hexagonal honeycombs?

What happens?:
It opens https://en.wikipedia.org/wiki/Draft:Why_do_bees_build_hexagonal_honeycombs?

What should have happened instead?:
It should open https://en.wikipedia.org/wiki/Draft:Why_do_bees_build_hexagonal_honeycombs%3F

Other information (browser name/version, screenshots, etc.):
Looks like the question mark is the issue.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Same issue with the history link.
Also on this report It links to https://en.wikipedia.org/wiki/Customizable_IPA instead of https://en.wikipedia.org/wiki/Template:Customizable_IPA. It probably should also show Template:Customizable IPA as the report page instead of just Customizable IPA.

Aklapper renamed this task from Link Issue to Links in report are not URL encoded.Jan 7 2025, 8:01 AM
Aklapper raised the priority of this task from Low to Needs Triage.

From my very limited understanding of the code, I think that a change on Record.php is all that's needed.

Was pointed at this task — not had the chance to test this, but a quick guess would be something like url_encoding in the twig template:

diff --git a/templates/feed.html.twig b/templates/feed.html.twig
index cee0216..1eeb308 100644
--- a/templates/feed.html.twig
+++ b/templates/feed.html.twig
@@ -20,12 +20,12 @@
{# Div for page title #}
<div class="row-div {% if has_wikiprojects %}col-sm-3{% else %}col-sm-4{% endif %} page-div">
        <strong>
-               <a href='{{ row.pageUrl }}' target="_blank" class="{{ row.pageDead ? 'text-danger' : '' }}">
+               <a href='{{ row.pageUrl|url_encode }}' target="_blank" class="{{ row.pageDead ? 'text-danger' : '' }}">
                        {{ row.pageTitle }}
                </a>
        </strong>
<div class="small">
-        <a href='{{ row.pageHistoryUrl }}' target="_blank" class="{{ row.pageDead ? 'text-danger' : '' }}">
+        <a href='{{ row.pageHistoryUrl|url_encode }}' target="_blank" class="{{ row.pageDead ? 'text-danger' : '' }}">
                {{ msg('history') }}
        </a>
{% if row.isNewPage and not(row.isPageDead) and 'delete' in user_rights %}