Bug 37595 - Double HTML escaped ampersand in pagination bar
Summary: Double HTML escaped ampersand in pagination bar
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Owen Leonard
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on: 30969
Blocks:
  Show dependency treegraph
 
Reported: 2024-08-07 14:59 UTC by Fridolin Somers
Modified: 2024-08-16 15:37 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00
Circulation function:


Attachments
Bug 37595: Double HTML escaped ampersand in pagination bar (2.16 KB, patch)
2024-08-08 18:01 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 37595: Double HTML escaped ampersand in pagination bar (2.22 KB, patch)
2024-08-09 08:18 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 37595: Double HTML escaped ampersand in pagination bar (2.31 KB, patch)
2024-08-16 07:27 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2024-08-07 14:59:47 UTC
Since Bug 30969 pagination bar contains double HTML escaped ampersand '&'.

For example in reports page 2 link is :
<a href="/cgi-bin/koha/reports/guided_reports.pl?id=1&amp;amp;op=run&amp;amp;limit=20&amp;amp;want_full_chart=0&amp;page=2">2</a>
Comment 1 Fridolin Somers 2024-08-07 15:00:40 UTC
Looks like Firefox deals with it but still a bug right ?
Comment 2 Owen Leonard 2024-08-07 16:08:14 UTC
For this particular case it looks like we can convert the '&amp;' to '&' in guided_reports.pl between line 974 and 979.

Generally, it looks like we're using '&amp;' in a lot of Perl code where I don't think we need to. For instance at line 345 of basketgroup.pl:

print $input->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=' . $booksellerid.'&amp;listclosed=1');

There's no need to encode that &. I'm guessing that in most places we use &amp; it's because obsolete XHTML validator rules required us to. A current validator won't complain about it and I question whether there are places that require it for other reasons.
Comment 3 David Cook 2024-08-07 23:57:59 UTC
(In reply to Owen Leonard from comment #2)
> For this particular case it looks like we can convert the '&amp;' to '&' in
> guided_reports.pl between line 974 and 979.
 
> Generally, it looks like we're using '&amp;' in a lot of Perl code where I
> don't think we need to. For instance at line 345 of basketgroup.pl:
 
> There's no need to encode that &. I'm guessing that in most places we use
> &amp; it's because obsolete XHTML validator rules required us to. A current
> validator won't complain about it and I question whether there are places
> that require it for other reasons.

+1
Comment 4 David Cook 2024-08-08 00:00:05 UTC
I'm not sure about bug 30969 either but...
Comment 5 Owen Leonard 2024-08-08 18:01:32 UTC
Created attachment 170162 [details] [review]
Bug 37595: Double HTML escaped ampersand in pagination bar

This patch removes escaping of ampersands in the part of
guided_reports.pl that builds information for the pagination routine.
The information is going to be escaped in a later step.

To test, apply the patch and go to Reports.

- If necessary, create a report which will return more than 20 results.
- Run the report. You should see a pagination bar at the top of the
  table of results.
- View the page source and look for the markup for the pagination menu.
  Searching for 'rel="start"' works well.
- Confirm that you see '&amp;' between the link parameters instead of
  '&amp;amp;', e.g.

  guided_reports.pl?id=347&amp;op=run&amp;limit=20&amp;want_full_chart=0&amp;page=1
Comment 6 Fridolin Somers 2024-08-09 08:18:47 UTC
Created attachment 170170 [details] [review]
Bug 37595: Double HTML escaped ampersand in pagination bar

This patch removes escaping of ampersands in the part of
guided_reports.pl that builds information for the pagination routine.
The information is going to be escaped in a later step.

To test, apply the patch and go to Reports.

- If necessary, create a report which will return more than 20 results.
- Run the report. You should see a pagination bar at the top of the
  table of results.
- View the page source and look for the markup for the pagination menu.
  Searching for 'rel="start"' works well.
- Confirm that you see '&amp;' between the link parameters instead of
  '&amp;amp;', e.g.

  guided_reports.pl?id=347&amp;op=run&amp;limit=20&amp;want_full_chart=0&amp;page=1

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Comment 7 Marcel de Rooy 2024-08-16 07:27:36 UTC
Created attachment 170432 [details] [review]
Bug 37595: Double HTML escaped ampersand in pagination bar

This patch removes escaping of ampersands in the part of
guided_reports.pl that builds information for the pagination routine.
The information is going to be escaped in a later step.

To test, apply the patch and go to Reports.

- If necessary, create a report which will return more than 20 results.
- Run the report. You should see a pagination bar at the top of the
  table of results.
- View the page source and look for the markup for the pagination menu.
  Searching for 'rel="start"' works well.
- Confirm that you see '&amp;' between the link parameters instead of
  '&amp;amp;', e.g.

  guided_reports.pl?id=347&amp;op=run&amp;limit=20&amp;want_full_chart=0&amp;page=1

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 8 Katrin Fischer 2024-08-16 15:37:42 UTC
Pushed for 24.11!

Well done everyone, thank you!