Bugzilla – Attachment 89352 Details for
Bug 22223
Item url double-encode when parameter is an encoded URL
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22223: Try to not double encoded URIs in items.uri
Bug-22223-Try-to-not-double-encoded-URIs-in-itemsu.patch (text/plain), 3.30 KB, created by
Jonathan Druart
on 2019-05-04 15:27:17 UTC
(
hide
)
Description:
Bug 22223: Try to not double encoded URIs in items.uri
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-05-04 15:27:17 UTC
Size:
3.30 KB
patch
obsolete
>From 589a0bf73d707aea0d99aad7045365e08f9c281b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sat, 4 May 2019 11:21:42 -0400 >Subject: [PATCH] Bug 22223: Try to not double encoded URIs in items.uri > >This is just a POC and is not ready for inclusion (Filter.pm and naming >need to be discussed). > >Test plan: >Create 2 items, with uri: > https://www.google.com/url?q=https://buttercup.pw > https://www.google.com/url?q=https%3A%2F%2Fbuttercup.pw > >Go to the OPAC detail page of the bib record, see that the links are >displayed how you entered them. >Click on them and confirm that the uri/page is correct >--- > Koha/Template/Plugin/Filter.pm | 32 ++++++++++++++++++++++ > .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 4 ++- > 2 files changed, 35 insertions(+), 1 deletion(-) > create mode 100644 Koha/Template/Plugin/Filter.pm > >diff --git a/Koha/Template/Plugin/Filter.pm b/Koha/Template/Plugin/Filter.pm >new file mode 100644 >index 0000000000..9dbd16022c >--- /dev/null >+++ b/Koha/Template/Plugin/Filter.pm >@@ -0,0 +1,32 @@ >+package Koha::Template::Plugin::Filter; >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use Template::Plugin::Filter; >+use base qw( Template::Plugin::Filter ); >+ >+our $DYNAMIC = 1; >+ >+sub no_double_encode { >+ my ( $self, $value ) = @_; >+ >+ $value =~ s/%25([0-9a-f]{2})/%$1/gi; >+ return $value; >+} >+ >+1; >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >index 7d25cde9db..4ce7af4bfa 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -3,6 +3,7 @@ > [% USE Math %] > [% USE Koha %] > [% USE KohaDates %] >+[% USE Filter %] > [% USE Branches %] > [% USE ColumnsSettings %] > [% USE AuthorisedValues %] >@@ -1335,7 +1336,8 @@ > [% IF Koha.Preference("OPACURLOpenInNewWindow") %] > <a target="_blank" rel="noreferrer" href="[% ITEM_RESULT.uri | url %]" property="url">[% ITEM_RESULT.uri | html %]</a> > [% ELSE %] >- <a href="[% ITEM_RESULT.uri | url %]" property="url">[% ITEM_RESULT.uri | html %]</a> >+ [% uri_url_filtered = BLOCK %][% ITEM_RESULT.uri | url %][% END %] >+ <a href="[% Filter.no_double_encode( uri_url_filtered ) | $raw %]" property="url">[% uri_url_filtered | html %]</a> > [% END %] > [% END %] > [% END %] >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22223
:
89352
|
126174
|
132027
|
133567
|
133578
|
133589
|
133590