From ba8583f8b009d15e5ae78d21bc700a990c6d10c4 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Mon, 04 Apr 2011 17:32:15 +0000 Subject: Copy to external device: do not fail on custom binary metadata OLPC #10807 Catch 'UnicodeDecodeError' and do not write the metadata if that error occurs but still write the file itself. Signed-off-by: Simon Schampijer Acked-By: Sascha Silbe --- diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py index 9cea65e..c768e2a 100644 --- a/src/jarabe/journal/model.py +++ b/src/jarabe/journal/model.py @@ -717,7 +717,7 @@ def _write_entry_on_external_device(metadata, file_path): try: metadata_json = simplejson.dumps(metadata_copy) - except EnvironmentError: + except (UnicodeDecodeError, EnvironmentError): logging.error('Could not convert metadata to json.') else: (fh, fn) = tempfile.mkstemp(dir=metadata['mountpoint']) -- cgit v0.9.1