Commit 8f43ae66 authored by Alexandre's avatar Alexandre
Browse files

Fix malformed UTF-8 character in JSON string error

The different database drivers do not retrieve the data with the same
Perl's internal representation. Therefore it is required to check this
representation before calling "decode_json" that "expects an UTF-8
(binary) string" (https://metacpan.org/pod/JSON::PP#decode_json).
parent 17483b55
......@@ -260,9 +260,11 @@ sub get_test_params {
my $result;
eval {
# TODO: do we use "encode_utf8" as this was the case in PostgreSQL
# (see commit diff)
$result = decode_json( $params_json );
if ( utf8::is_utf8( $params_json ) ) {
$result = decode_json( encode_utf8( $params_json ) );
} else {
$result = decode_json( $params_json );
}
};
die Zonemaster::Backend::Error::JsonError->new( reason => "$@", data => { test_id => $test_id } )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment