diff --git a/lib/Catalyst/Plugin/NGCP/EscapeURI.pm b/lib/Catalyst/Plugin/NGCP/EscapeURI.pm new file mode 100644 index 0000000000..4d81aefe6d --- /dev/null +++ b/lib/Catalyst/Plugin/NGCP/EscapeURI.pm @@ -0,0 +1,13 @@ +package Catalyst::Plugin::NGCP::EscapeURI; +use warnings; +use strict; +use MRO::Compat; + +use NGCP::Panel::Utils::Generic qw(); + +sub escape_uri { + my $c = shift; + return NGCP::Panel::Utils::Generic::escape_uri(@_); +} + +1; diff --git a/lib/NGCP/Panel.pm b/lib/NGCP/Panel.pm index c387120606..ccd9f53d78 100644 --- a/lib/NGCP/Panel.pm +++ b/lib/NGCP/Panel.pm @@ -28,6 +28,7 @@ use Catalyst qw/ Session::State::Cookie NGCP::EscapeSensitiveValue NGCP::EscapeJs + NGCP::EscapeURI I18N /; use Log::Log4perl::Catalyst qw(); diff --git a/lib/NGCP/Panel/Utils/Generic.pm b/lib/NGCP/Panel/Utils/Generic.pm index 36165cc0fc..f6ee8ff044 100644 --- a/lib/NGCP/Panel/Utils/Generic.pm +++ b/lib/NGCP/Panel/Utils/Generic.pm @@ -2,14 +2,15 @@ package NGCP::Panel::Utils::Generic; use strict; use warnings; use Exporter; +use URI::Escape qw(uri_escape_utf8); use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = (); -@EXPORT_OK = qw(is_int is_integer is_decimal merge compare is_false is_true get_inflated_columns_all hash2obj mime_type_to_extension extension_to_mime_type array_to_map escape_js); -%EXPORT_TAGS = ( DEFAULT => [qw(&is_int &is_integer &is_decimal &merge &compare &is_false &is_true &mime_type_to_extension &extension_to_mime_type &array_to_map &escape_js)], - all => [qw(&is_int &is_integer &is_decimal &merge &compare &is_false &is_true &get_inflated_columns_all &hash2obj &mime_type_to_extension &extension_to_mime_type &array_to_map &escape_js)]); +@EXPORT_OK = qw(is_int is_integer is_decimal merge compare is_false is_true get_inflated_columns_all hash2obj mime_type_to_extension extension_to_mime_type array_to_map escape_js escape_uri); +%EXPORT_TAGS = ( DEFAULT => [qw(&is_int &is_integer &is_decimal &merge &compare &is_false &is_true &mime_type_to_extension &extension_to_mime_type &array_to_map &escape_js escape_uri)], + all => [qw(&is_int &is_integer &is_decimal &merge &compare &is_false &is_true &get_inflated_columns_all &hash2obj &mime_type_to_extension &extension_to_mime_type &array_to_map &escape_js escape_uri)]); use Hash::Merge; use Data::Compare qw//; @@ -222,4 +223,9 @@ sub escape_js { return $str; } +sub escape_uri { + my $str = shift // ''; + return uri_escape_utf8($str); +} + 1; diff --git a/share/layout/body.tt b/share/layout/body.tt index aff4ace953..1560f60ba8 100644 --- a/share/layout/body.tt +++ b/share/layout/body.tt @@ -125,7 +125,7 @@ [% IF c.config.general.ui_enable -%] [% IF c.user.roles == 'admin' || c.user.roles == 'reseller' || c.user.roles == 'ccareadmin' || c.user.roles == 'ccare' || c.user.roles == 'lintercept' -%]
[% END -%] [% END -%] @@ -202,7 +202,7 @@ var mainWrapperInit = function () { }); [% - backuri = c.req.uri; + backuri = c.escape_uri(c.req.uri); tmp = backuri.query_param_delete('back'); -%] $('a').each(function() {