Bugzilla – Attachment 133590 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: Add tests
Bug-22223-Add-tests.patch (text/plain), 2.10 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-04-21 16:17:05 UTC
(
hide
)
Description:
Bug 22223: Add tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-04-21 16:17:05 UTC
Size:
2.10 KB
patch
obsolete
>From 4d9e7737e121073550b08a2846d0b7bf7763db3a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 21 Apr 2022 17:45:14 +0200 >Subject: [PATCH] Bug 22223: Add tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Edit: fixed tests count >--- > t/Koha_Template_Plugin_Filter.t | 45 +++++++++++++++++++++++++++++++++ > 1 file changed, 45 insertions(+) > create mode 100755 t/Koha_Template_Plugin_Filter.t > >diff --git a/t/Koha_Template_Plugin_Filter.t b/t/Koha_Template_Plugin_Filter.t >new file mode 100755 >index 00000000000..1865eb30aaf >--- /dev/null >+++ b/t/Koha_Template_Plugin_Filter.t >@@ -0,0 +1,45 @@ >+#!/usr/bin/env perl >+ >+# 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, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Test::More tests => 2; >+use Template; >+ >+my $template = Template->new({ >+ PLUGIN_BASE => 'Koha::Template::Plugin', >+}); >+ >+my $tt = <<EOF; >+[%- USE raw %] >+[%- USE Filter %] >+[%~ uri_url_filtered = BLOCK %][% uri | url ~%][% END -%] >+[%- Filter.no_double_encode( uri_url_filtered ) | \$raw -%] >+EOF >+ >+my $uri = 'https://www.foo.com/url?q=https://bar.org'; >+my $encoded_uri = 'https://www.foo.com/url?q=https%3A%2F%2Fbar.org'; >+my $output = ''; >+my $vars = { uri => $uri }; >+$template->process(\$tt, $vars, \$output); >+is($output, $uri); >+ >+$output = ''; >+$vars = { uri => $encoded_uri }; >+$template->process(\$tt, $vars, \$output); >+# uri filter would have generated https://www.foo.com/url?q=https%253A%252F%252Fbar.org >+is($output, $encoded_uri, 'URI is not double encoded'); >-- >2.34.1
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
|
170485
|
170577
|
174101
|
174104
|
174105