[FIX] base : new attachement directory creation
Fix race-condition when a directory is created by two processes (python's os.py handles it for all directories, but not for the last one). Happens sometimes when generating assets for the first time (CSS, JS); one of the two times might crash. sentry-4417110945 closes odoo/odoo#156232 Signed-off-by: Fabien Pinckaers (fp) <fp@odoo.com>
This commit is contained in:
@@ -109,7 +109,7 @@ class IrAttachment(models.Model):
|
||||
full_path = self._full_path(fname)
|
||||
dirname = os.path.dirname(full_path)
|
||||
if not os.path.isdir(dirname):
|
||||
os.makedirs(dirname)
|
||||
os.makedirs(dirname, exist_ok=True)
|
||||
# prevent sha-1 collision
|
||||
if os.path.isfile(full_path) and not self._same_content(bin_data, full_path):
|
||||
raise UserError(_("The attachment collides with an existing file."))
|
||||
|
||||
Reference in New Issue
Block a user