Skip to content

Commit

Permalink
Merge commit 'refs/pull/284/head' of https://github.com/camptocamp/od…
Browse files Browse the repository at this point in the history
…oo-cloud-platform into 13.0-2446
  • Loading branch information
docker-odoo committed May 21, 2023
2 parents 994142e + 93a94a8 commit ce9e485
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions attachment_s3/models/ir_attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,15 @@ def _store_file_write(self, key, bin_data):
file.write(bin_data)
file.seek(0)
filename = 's3://%s/%s' % (bucket.name, key)
# if the object already exists skip re-uploading so that:
# we dont break retencion policy and we dont need update rights
# TODO handle this on a better way
try:
if obj.content_length:
_logger.info('Skip uploading object %s, already exists', filename)
return filename
except Exception:
pass
try:
obj.upload_fileobj(file)
except ClientError as error:
Expand Down

0 comments on commit ce9e485

Please sign in to comment.