From 5504abf78069e547d3f27f7891474b2424969c6a Mon Sep 17 00:00:00 2001 From: James O'Shannessy <12959316+joshanne@users.noreply.github.com> Date: Thu, 7 Sep 2023 13:36:52 +1000 Subject: [PATCH] Load: Ensure single byte strings (GPS LatitudeRef and LongitudeRef) can be decoded and re-encoded properly --- piexif/_load.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/piexif/_load.py b/piexif/_load.py index e815850..0df353e 100644 --- a/piexif/_load.py +++ b/piexif/_load.py @@ -164,6 +164,8 @@ def convert_value(self, val): if length > 4: pointer = struct.unpack(self.endian_mark + "L", value)[0] data = self.tiftag[pointer : pointer + length - 1] + elif length == 1: + data = value[0:length] else: data = value[0 : length - 1] elif t == TYPES.Short: # SHORT