Skip to content

Commit af456fe

Browse files
[Blob][Fileshare] Ensured that download fails if blob/file modified mid download (Azure#19276)
* Ensured that download fails if blob/file modified mid download * fixed linter * ResourceModifiedError
1 parent 80e7b9e commit af456fe

File tree

12 files changed

+2109
-13
lines changed

12 files changed

+2109
-13
lines changed

sdk/storage/azure-storage-blob/azure/storage/blob/_download.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,8 @@ def _initial_request(self):
460460
# If the file is small, the download is complete at this point.
461461
# If file size is large, download the rest of the file in chunks.
462462
if response.properties.size != self.size:
463-
# Lock on the etag. This can be overriden by the user by specifying '*'
464463
if self._request_options.get("modified_access_conditions"):
465-
if not self._request_options["modified_access_conditions"].if_match:
466-
self._request_options["modified_access_conditions"].if_match = response.properties.etag
464+
self._request_options["modified_access_conditions"].if_match = response.properties.etag
467465
else:
468466
self._download_complete = True
469467
return response

sdk/storage/azure-storage-blob/azure/storage/blob/aio/_download_async.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,8 @@ async def _initial_request(self):
352352
# If the file is small, the download is complete at this point.
353353
# If file size is large, download the rest of the file in chunks.
354354
if response.properties.size != self.size:
355-
# Lock on the etag. This can be overriden by the user by specifying '*'
356355
if self._request_options.get('modified_access_conditions'):
357-
if not self._request_options['modified_access_conditions'].if_match:
358-
self._request_options['modified_access_conditions'].if_match = response.properties.etag
356+
self._request_options['modified_access_conditions'].if_match = response.properties.etag
359357
else:
360358
self._download_complete = True
361359
return response

0 commit comments

Comments
 (0)