Bug 14224: Improve escaped characters
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 1 Feb 2017 16:01:00 +0000 (17:01 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 28 Apr 2017 13:03:23 +0000 (09:03 -0400)
To recreate the problem, submit a note like
  doh"doh

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
opac/svc/patron_notes

index 1ae53ae..e26c266 100755 (executable)
@@ -19,6 +19,7 @@
 
 use Modern::Perl;
 
+use JSON qw( to_json );
 use C4::Service;
 use C4::Auth qw /check_cookie_auth/;
 use C4::Letters;
@@ -96,8 +97,8 @@ if ($is_ajax) {
             $status = "fail";
         }
 
-        my $response = "{\"status\": \"$status\", \"note\": \"$clean_note\", \"issue_id\": \"$issue_id\"}";
-        output_with_http_headers($query, undef, $response, 'js');
+        my $json = to_json ( { status => $status, note => $clean_note, issue_id => $issue_id } );
+        output_with_http_headers($query, undef, $json, 'json');
         exit;
     } # END Issue Note
 }