Skip to content

Commit

Permalink
Check that gallery_info exist inside eze info.json, and return an err…
Browse files Browse the repository at this point in the history
…or message if not (#1097)
  • Loading branch information
siliconfeces authored Oct 22, 2024
1 parent 3765035 commit edacd1e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/LANraragi/Plugin/Metadata/Eze.pm
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ sub get_tags {

$logger->debug("Loaded the following JSON: $stringjson");

if ($hashjson->{gallery_info} == undef) {
return (error => "The info.json file could not be parsed as an eze file!");
}

#Parse it
my ( $tags, $title ) = tags_from_eze_json( $origin_title, $additional_tags, $hashjson );

Expand Down
13 changes: 13 additions & 0 deletions tests/LANraragi/Plugin/Metadata/Eze.t
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,17 @@ note("eze-full Tests, origin_title on, additional_tags off");
);
}


note("eze no gallery_info file");
{
my $origin_title = 1;
my $additional_tags = 0;

my %ezetags = eve_test( "/eze/eze_broken.json", $origin_title, $additional_tags );

is( $ezetags{title}, undef, "no title returned");
is( $ezetags{tags}, undef, "no tags returned");
isnt( $ezetags{error}, undef, "Proper error returned");
}

done_testing();
3 changes: 3 additions & 0 deletions tests/samples/eze/eze_broken.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"title": "Broken"
}

0 comments on commit edacd1e

Please sign in to comment.