From c21146f94d84ec44a1386c82e47c42cb8625919f Mon Sep 17 00:00:00 2001 From: evazion Date: Thu, 3 Nov 2022 04:08:26 -0500 Subject: [PATCH] media file: fix error when calculating dimensions of corrupt gif. Fix exception when `MediaFile::Image#dimensions` calls `metadata.width`. Caused by the `ExifTool::Metadata#merge` method returning a Hash instead of a new `ExifTool::Metadata` instance. --- app/logical/exif_tool.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/logical/exif_tool.rb b/app/logical/exif_tool.rb index 5933798b4..bddda7716 100644 --- a/app/logical/exif_tool.rb +++ b/app/logical/exif_tool.rb @@ -47,6 +47,10 @@ class ExifTool @metadata = metadata end + def merge(hash) + Metadata.new(metadata.merge(hash)) + end + def is_animated? frame_count.to_i > 1 || is_animated_webp? || is_animated_avif? end