[FIX] ir.attachment: no crash on missing file with bin_size=True
When bin_size=True is passed, `os.path.getsize()` raises an OSError rather than IOError when the file cannot be found.
This commit is contained in:
@@ -149,7 +149,7 @@ class ir_attachment(osv.osv):
|
||||
r = os.path.getsize(full_path)
|
||||
else:
|
||||
r = open(full_path,'rb').read().encode('base64')
|
||||
except IOError:
|
||||
except (IOError, OSError):
|
||||
_logger.info("_read_file reading %s", full_path, exc_info=True)
|
||||
return r
|
||||
|
||||
|
||||
Reference in New Issue
Block a user