|
42 | 42 | from ._shared.request_handlers import add_metadata_headers, get_length |
43 | 43 | from ._shared.response_handlers import return_response_headers, process_storage_error |
44 | 44 | from ._shared.uploads import IterStreamer, FileChunkUploader, upload_data_chunks |
45 | | -from ._shared.validation import CV_TYPE_PARSED, parse_validation_option |
| 45 | +from ._shared.validation import CV_TYPE_PARSED, is_crc64_validation, parse_validation_option |
46 | 46 |
|
47 | 47 | if TYPE_CHECKING: |
48 | 48 | from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential, TokenCredential |
@@ -902,7 +902,13 @@ def download_file( |
902 | 902 | :keyword validate_content: |
903 | 903 | Enables checksum validation for the transfer. Any checksum calculated is NOT stored with the file. |
904 | 904 | Choose "auto" (let the SDK choose the best algorithm), "crc64", or "md5". The use of bool is deprecated. |
905 | | - NOTE: The use of "auto" or "crc64" requires the `azure-storage-extensions` package to be installed. |
| 905 | +
|
| 906 | + .. note:: When using CRC64 validation (including when "auto" resolves to CRC64): |
| 907 | +
|
| 908 | + - The ``ext-checksums`` extra must be installed. |
| 909 | + - Automatic decompression is not supported. If ``decompress=True`` is explicitly |
| 910 | + set, a :class:`ValueError` will be raised. If ``decompress`` is not specified, |
| 911 | + it will be set to ``False`` automatically. |
906 | 912 | :paramtype validate_content: Union[bool, Literal['auto', 'crc64', 'md5']] |
907 | 913 | :keyword lease: |
908 | 914 | Required if the file has an active lease. Value can be a ShareLeaseClient object |
@@ -945,6 +951,13 @@ def download_file( |
945 | 951 | access_conditions = get_access_conditions(kwargs.pop("lease", None)) |
946 | 952 | validate_content = parse_validation_option(kwargs.pop("validate_content", None)) |
947 | 953 |
|
| 954 | + # Decompression is not supported with CRC64 content validation |
| 955 | + if is_crc64_validation(validate_content): |
| 956 | + decompress = kwargs.get("decompress") |
| 957 | + if decompress is True: |
| 958 | + raise ValueError("Decompression is not supported when using CRC64 content validation.") |
| 959 | + kwargs["decompress"] = False |
| 960 | + |
948 | 961 | return StorageStreamDownloader( |
949 | 962 | client=self._client.file, |
950 | 963 | config=self._config, |
|
0 commit comments