Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def get_chunk_offsets(self):

async def process_chunk(self, chunk_start):
chunk_start, chunk_end = self._calculate_range(chunk_start)
chunk_data = await self._download_chunk(chunk_start, chunk_end)
chunk_data = await self._download_chunk(chunk_start, chunk_end-1)
length = chunk_end - chunk_start
if length > 0:
await self._write_to_stream(chunk_data, chunk_start)
Expand Down Expand Up @@ -142,12 +142,12 @@ async def _download_chunk(self, chunk_start, chunk_end):
download_range, offset = process_range_and_offset(
chunk_start, chunk_end, chunk_end, self.encryption_options)

if self._do_optimize(download_range[0], download_range[1] - 1):
if self._do_optimize(download_range[0], download_range[1]):
chunk_data = b"\x00" * self.chunk_size
else:
range_header, range_validation = validate_and_format_range_headers(
download_range[0],
download_range[1] - 1,
download_range[1],
check_content_md5=self.validate_content)
try:
_, response = await self.client.download(
Expand Down
6 changes: 3 additions & 3 deletions sdk/storage/azure-storage-blob/azure/storage/blob/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def get_chunk_offsets(self):

def process_chunk(self, chunk_start):
chunk_start, chunk_end = self._calculate_range(chunk_start)
chunk_data = self._download_chunk(chunk_start, chunk_end)
chunk_data = self._download_chunk(chunk_start, chunk_end-1)
length = chunk_end - chunk_start
if length > 0:
self._write_to_stream(chunk_data, chunk_start)
Expand Down Expand Up @@ -163,11 +163,11 @@ def _download_chunk(self, chunk_start, chunk_end):

# No need to download the empty chunk from server if there's no data in the chunk to be downloaded.
# Do optimize and create empty chunk locally if condition is met.
if self._do_optimize(download_range[0], download_range[1] - 1):
if self._do_optimize(download_range[0], download_range[1]):
chunk_data = b"\x00" * self.chunk_size
else:
range_header, range_validation = validate_and_format_range_headers(
download_range[0], download_range[1] - 1, check_content_md5=self.validate_content
download_range[0], download_range[1], check_content_md5=self.validate_content
)

try:
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion sdk/storage/azure-storage-blob/tests/test_blob_encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ def setUp(self):
credential=credential,
max_single_put_size=32 * 1024,
max_block_size=4 * 1024,
max_page_size=4 * 1024)
max_page_size=4 * 1024,
max_single_get_size=1024,
max_chunk_get_size=1024)
self.config = self.bsc._config
self.container_name = self.get_resource_name('utcontainer')
self.blob_types = (BlobType.BlockBlob, BlobType.PageBlob, BlobType.AppendBlob)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def setUp(self):
max_single_put_size=32 * 1024,
max_block_size=4 * 1024,
max_page_size=4 * 1024,
max_single_get_size=4 * 1024,
transport=AiohttpTestTransport())
self.config = self.bsc._config
self.container_name = self.get_resource_name('utcontainer')
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/azure-storage-blob/tests/test_get_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def setUp(self):
self.bsc = BlobServiceClient(
url,
credential=credential,
max_single_get_size=32 * 1024,
max_chunk_get_size=4 * 1024)
max_single_get_size=1024,
max_chunk_get_size=1024)
self.config = self.bsc._config
self.container_name = self.get_resource_name('utcontainer')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def get_chunk_offsets(self):

async def process_chunk(self, chunk_start):
chunk_start, chunk_end = self._calculate_range(chunk_start)
chunk_data = await self._download_chunk(chunk_start, chunk_end)
chunk_data = await self._download_chunk(chunk_start, chunk_end-1)
length = chunk_end - chunk_start
if length > 0:
await self._write_to_stream(chunk_data, chunk_start)
Expand Down Expand Up @@ -103,7 +103,7 @@ async def _download_chunk(self, chunk_start, chunk_end):
chunk_start, chunk_end, chunk_end, self.encryption_options)
range_header, range_validation = validate_and_format_range_headers(
download_range[0],
download_range[1] - 1,
download_range[1],
check_content_md5=self.validate_content)

try:
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/azure-storage-file/azure/storage/file/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def get_chunk_offsets(self):

def process_chunk(self, chunk_start):
chunk_start, chunk_end = self._calculate_range(chunk_start)
chunk_data = self._download_chunk(chunk_start, chunk_end)
chunk_data = self._download_chunk(chunk_start, chunk_end-1)
length = chunk_end - chunk_start
if length > 0:
self._write_to_stream(chunk_data, chunk_start)
Expand All @@ -132,7 +132,7 @@ def _download_chunk(self, chunk_start, chunk_end):
chunk_start, chunk_end, chunk_end, self.encryption_options
)
range_header, range_validation = validate_and_format_range_headers(
download_range[0], download_range[1] - 1, check_content_md5=self.validate_content
download_range[0], download_range[1], check_content_md5=self.validate_content
)

try:
Expand Down