[PhotoFloat] [PATCH] Sanitize EXIF date string

martin f. krafft madduck at madduck.net
Sun Jan 18 20:39:10 CET 2015


I've seen cameras slap \0 bytes and other junk incl. whitespace into the
EXIF tags, so let's sanitise the string a little bit.

Signed-off-by: martin f. krafft <madduck at madduck.net>
---
 scanner/PhotoAlbum.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scanner/PhotoAlbum.py b/scanner/PhotoAlbum.py
index fffe4ac..92fa608 100644
--- a/scanner/PhotoAlbum.py
+++ b/scanner/PhotoAlbum.py
@@ -316,6 +316,7 @@ class Photo(object):
 		else:
 			correct_date = self._attributes["dateTimeFile"]
 		if isinstance(correct_date, unicode):
+		        correct_date = correct_date.split('\x00',1)[0].strip()
 			correct_date = datetime.strptime(correct_date, '%Y:%m:%d %H:%M:%S')
 		return correct_date
 
-- 
2.1.4



More information about the PhotoFloat mailing list