Skip to content

Commit 2aa836e

Browse files
committed
Make mirror_file fail if file object already exists (#7134)
1 parent 5071913 commit 2aa836e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/azul/indexer/mirror_service.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def mirror_file(self, catalog: CatalogName, file: File):
156156
self._storage(catalog).put(object_key=self.mirror_object_key(file),
157157
data=file_content,
158158
content_type=file.content_type,
159-
IfNoneMatch='*')
159+
exists_okay=False)
160160
_, digest_type = file.digest()
161161
hasher = get_resumable_hasher(digest_type)
162162
hasher.update(file_content)
@@ -204,7 +204,9 @@ def finish_mirroring_file(self,
204204
Complete a multipart upload begun with :meth:`begin_mirroring_file`.
205205
"""
206206
upload = self._get_upload(catalog, file, upload_id)
207-
self._storage(catalog).complete_multipart_upload(upload, etags)
207+
self._storage(catalog).complete_multipart_upload(upload,
208+
etags,
209+
exists_okay=False)
208210
self._verify_digest(file, hasher)
209211
self._check_info(catalog, file)
210212
self._put_info(catalog, file)

0 commit comments

Comments
 (0)