projects
/
koha.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
Bug 19655: Make To.json escape doesn't escape newlines to create valid JSON
[koha.git]
/
Koha
/
Template
/
Plugin
/
To.pm
diff --git
a/Koha/Template/Plugin/To.pm
b/Koha/Template/Plugin/To.pm
index
6bf56b1
..
f87a39c
100644
(file)
--- a/
Koha/Template/Plugin/To.pm
+++ b/
Koha/Template/Plugin/To.pm
@@
-29,6
+29,8
@@
sub json {
my $json = JSON->new->allow_nonref(1);
$json = $json->encode($value);
$json =~ s/^"|"$//g; # Remove quotes around the strings
+ $json =~ s/\\r/\\\\r/g; # Convert newlines to escaped newline characters
+ $json =~ s/\\n/\\\\n/g;
return $json;
}