From c341a18de7dc27e65df66a188b4b9aac5c6208a3 Mon Sep 17 00:00:00 2001 From: oPromessa Date: Tue, 5 Nov 2024 12:10:22 +0000 Subject: [PATCH] For non-compliant exiftool -OffsetTimeOriginal values, protect get_exif_date_time_offset prior to callingexif_offset_to_seconds. Check if offset matches '+/-hh:mm' format. (#1697) --- osxphotos/exifutils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osxphotos/exifutils.py b/osxphotos/exifutils.py index af11e6c5..614ae659 100644 --- a/osxphotos/exifutils.py +++ b/osxphotos/exifutils.py @@ -122,6 +122,11 @@ def get_exif_date_time_offset( dt = f"{matched.group(1)} 00:00:00" default_time = True + if offset: + # make sure we have offset + if not re.match(r"([+-]\d{2}:\d{2})", offset): + offset = None + offset_seconds = exif_offset_to_seconds(offset) if offset else None if dt: