diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2007-10-03 23:15:16 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2007-10-03 23:15:16 +0200 |
commit | 1d1ad1b25af91d63ef9d2cd4df4925d9da9372f4 (patch) | |
tree | 0873c0fad25f47752cbe7f7018050238ec845fd9 /src/pyexiv2.py | |
parent | 57bbe34df56ccc0bc53b207c0e34ab2111e568df (diff) | |
download | pyexiv2-1d1ad1b25af91d63ef9d2cd4df4925d9da9372f4.tar.gz |
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.
Diffstat (limited to 'src/pyexiv2.py')
-rw-r--r-- | src/pyexiv2.py | 7 |
1 files changed, 5 insertions, 2 deletions
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': |