From: Dan Scott Date: Tue, 3 May 2011 20:48:48 +0000 (-0400) Subject: Ensure ampersands in URLs are & per HTML spec X-Git-Tag: sprint4-merge-nov22~5128^2~72^2~60^2~1^2~4 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c88c0ac5f43a408bca0fe337991517edc3aef2c1;p=working%2FEvergreen.git Ensure ampersands in URLs are & per HTML spec The propagator variable defined in parts/header.tt2 holds the value of the CGI query string - which, as it comes off the wire, is a simple "&". The problem with this is perhaps best explained at http://www.htmlhelp.com/tools/validator/problems.html#amp (and it explains why "©_..." gets converted into a copyright symbol). By passing the incoming query string through the TT url filter and then replacing "&" with "&" we avoid this problem at the source. From there, we have to address the other locations in the code in which we are manually appending GET variables. Signed-off-by: Dan Scott --- diff --git a/Open-ILS/web/templates/default/opac/parts/header.tt2 b/Open-ILS/web/templates/default/opac/parts/header.tt2 index 08c5ca69e7..4c68368f24 100644 --- a/Open-ILS/web/templates/default/opac/parts/header.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/header.tt2 @@ -17,7 +17,8 @@ replace(';x=\d+','') | replace(';y=\d+','') | replace(';page=\d*', '') | replace(';', '&'); - propagator = '?' _ query_string; + + propagator = '?' _ query_string | url | replace('&', '&'); is_advanced = CGI.param("_adv").size; %] diff --git a/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 b/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 index 26e1056c67..c34cf9a15f 100644 --- a/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 @@ -30,8 +30,8 @@ [% l("Author") %]: [% attrs.author %] + href="[% ctx.opac_root %]/results?qtype=author&query=[%- + attrs.author | replace('[,\.:;]', '') | uri %]&loc=[% CGI.param('loc') | uri %]">[% attrs.author %] [% END %] @@ -39,7 +39,7 @@
@@ -165,16 +165,14 @@ new_offset = ctx.copy_offset - ctx.copy_limit; IF new_offset < 0; new_offset = 0; END %] - [%# For some reason, browsers render © (as in, ©_limit=foo) as the copyright - symbol, even though it's inside inside the href attribute string. Use ; instead %] - « [% + « [% l('Previous [_1]', ctx.copy_offset - new_offset) %] [% END %] [% IF ctx.copies.size >= ctx.copy_limit %] - [% + [% l('Next [_1]', ctx.copy_limit) %] » @@ -221,7 +219,7 @@
- [% l('Place Hold') %][% l('Place Hold') %] [% l('Reviews and More') %]