Bugzilla – Attachment 83288 Details for
Bug 22007
KohaDates output does not need to be html filtered
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22007: Also handle Price and HtmlTags
Bug-22007-Also-handle-Price-and-HtmlTags.patch (text/plain), 2.24 KB, created by
Owen Leonard
on 2018-12-17 14:18:12 UTC
(
hide
)
Description:
Bug 22007: Also handle Price and HtmlTags
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2018-12-17 14:18:12 UTC
Size:
2.24 KB
patch
obsolete
>From a1555b71b3af2ef4047dbbf1066b9fa9653428fc Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 14 Dec 2018 17:34:52 -0300 >Subject: [PATCH] Bug 22007: Also handle Price and HtmlTags > >Those 2 filters should return safe output as well > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > t/lib/QA/TemplateFilters.pm | 4 ++++ > t/template_filters.t | 6 +++++- > 2 files changed, 9 insertions(+), 1 deletion(-) > >diff --git a/t/lib/QA/TemplateFilters.pm b/t/lib/QA/TemplateFilters.pm >index c4ec77d..0fce6da 100644 >--- a/t/lib/QA/TemplateFilters.pm >+++ b/t/lib/QA/TemplateFilters.pm >@@ -134,6 +134,8 @@ sub process_tt_block { > # Already escaped with a special filter > # We could escape it but should be safe > or $tt_block =~ m{\s?\|\s?\$KohaDates[^\|]*$} >+ or $tt_block =~ m{\s?\|\s?\$Price[^\|]*$} >+ or $tt_block =~ m{\s?\|\s?\$HtmlTags[^\|]*$} > > # Already escaped correctly with raw > or $tt_block =~ m{\|\s?\$raw} >@@ -166,6 +168,8 @@ sub process_tt_block { > : q| |; > > if ( $tt_block =~ m{\s?\|\s?\$KohaDates[^\|]*\|.*$} >+ or $tt_block =~ m{\s?\|\s?\$Price[^\|]*\|.*$} >+ or $tt_block =~ m{\s?\|\s?\$HtmlTags[^\|]*\|.*$} > ) { > $tt_block =~ > s/\s*\|\s*(uri|url|html)\s*$//; # Could be another filter... >diff --git a/t/template_filters.t b/t/template_filters.t >index e469835..fb30229 100644 >--- a/t/template_filters.t >+++ b/t/template_filters.t >@@ -261,13 +261,15 @@ INPUT > is_deeply( \@missing_filters, [], 'html_entity is a valid filter for href' ); > }; > >-subtest 'Do not escape KohaDates output' => sub { >+subtest 'Do not escape KohaDates|Prices|HtmlTags output' => sub { > plan tests => 2; > my $input = <<INPUT; > [% var | \$KohaDates %] > [% var | \$KohaDates with_hours => 1 %] > [% var | \$KohaDates | html %] > [% var | \$KohaDates with_hours => 1 | html %] >+[% var | \$Price %] >+[% var | \$HtmlTags %] > INPUT > > my $expected = <<EXPECTED; >@@ -275,6 +277,8 @@ INPUT > [% var | \$KohaDates with_hours => 1 %] > [% var | \$KohaDates %] > [% var | \$KohaDates with_hours => 1 %] >+[% var | \$Price %] >+[% var | \$HtmlTags %] > EXPECTED > > my $new_content = t::lib::QA::TemplateFilters::fix_filters($input); >-- >2.1.4
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 22007
:
83248
|
83249
|
83250
|
83251
|
83286
|
83287
|
83288
|
83289
|
83561
|
83562
|
83563
|
83564