Skip to content

Commit

Permalink
shaving off one error by realizing error codes were success codes and…
Browse files Browse the repository at this point in the history
… flipping their conditions
  • Loading branch information
mwarin committed Aug 2, 2024
1 parent 46e953c commit 6ed30cf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/HTFeed/Stage/ImageRemediate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ sub repair_tiff_imagemagick {
$self->{job_metrics}->add("ingest_imageremediate_bytes_w_total", -s $outfile, $labels);
$self->{job_metrics}->add("ingest_imageremediate_seconds_total", $delta_time, $labels);
$self->{job_metrics}->inc("ingest_imageremediate_images_total", $labels);
croak("failed repairing $infile\n") if $rval;
croak("failed repairing $infile\n") unless $rval;

# Some metadata may be lost when imagemagick compresses infile to outfile.
# Here we are putting Artist back, or we'll crash at a later stage,
Expand Down Expand Up @@ -1145,7 +1145,7 @@ sub convert_tiff_to_jpeg2000 {
$magick_args{'-depth'} = '8';
}

my $magick_compress_err = HTFeed::Image::Magick::compress(
my $magick_compress_success = HTFeed::Image::Magick::compress(
$infile,
"$infile.unc.tif",
%magick_args
Expand All @@ -1160,7 +1160,7 @@ sub convert_tiff_to_jpeg2000 {
);
$self->{job_metrics}->inc("ingest_imageremediate_images_total", $labels);

if ($magick_compress_err) {
if (!$magick_compress_success) {
$self->set_error(
"OperationFailed",
operation => "imagemagick",
Expand All @@ -1176,13 +1176,13 @@ sub convert_tiff_to_jpeg2000 {
$exifTool->SetNewValue('XMP', undef, Protected => 1);
$self->update_tags($exifTool, "$infile.unc.tif");

my $grk_compress_err = HTFeed::Image::Grok::compress(
my $grk_compress_success = HTFeed::Image::Grok::compress(
"$infile.unc.tif",
"$outfile",
$levels
);

if ($grk_compress_err) {
if (!$grk_compress_success) {
$self->set_error(
"OperationFailed",
operation => "grk_compress",
Expand Down

0 comments on commit 6ed30cf

Please sign in to comment.