From 1d1ad1b25af91d63ef9d2cd4df4925d9da9372f4 Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Wed, 3 Oct 2007 23:15:16 +0200 Subject: Fixed bug #146323 (Multi value fields are broken): when a EXIF tag value is not well formed, containing several short values separated by spaces (e.g. "2 3 4 5"), keep only the first of these values. --- src/pyexiv2.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/pyexiv2.py b/src/pyexiv2.py index 1cb1586..9cb19cf 100644 --- a/src/pyexiv2.py +++ b/src/pyexiv2.py @@ -304,9 +304,12 @@ class Image(libpyexiv2.Image): # try to guess if the value is a datetime return StringToDateTime(tagValue) elif tagType == 'Short': - return int(tagValue) + # In case the tag value is malformed, containing several short + # values separated by spaces (e.g. "2 3 4 5", see bug #146323), + # keep only the first of these values. + return int(tagValue.split()[0]) elif tagType == 'Long' or tagType == 'SLong': - return long(tagValue) + return long(tagValue.split()[0]) # for Rational and SRational types, we use tuples # TODO: define a rational type? elif tagType == 'Rational': -- cgit