Commit 4c1c04a6 authored by Yan Sushchynski (EPAM)'s avatar Yan Sushchynski (EPAM)
Browse files

GONRG-1869: Hot fixes for FileHandler and GoogleCloudStorageClient

parent cb859e02
Pipeline #27016 passed with stages
in 11 minutes and 8 seconds
......@@ -75,12 +75,12 @@ class FileHandler(HeadersMixin):
self.token_refresher = token_refresher
self._blob_storage_client = blob_storage_client or blob_storage.get_client()
def _get_file_from_preload_path(self, preload_path: str,
def _get_file_from_preload_path(self, preload_file_path: str,
file: FileLikeObject) -> Tuple[FileLikeObject, str]:
"""Get file from a preloaded path.
:param preload_path: Full URI of the file to obtain
:type preload_path: str
:param preload_file_path: Full URI of the file to obtain
:type preload_file_path: str
:return: Raw file data and content-type
:rtype: Tuple[FileLikeObject, str]
......@@ -104,7 +104,7 @@ class GoogleCloudStorageClient(BlobStorageClient):
bucket = self._storage_client.bucket(bucket_name)
blob = bucket.get_blob(source_blob_name)
file_as_bytes = blob.download_as_bytes()
file_as_bytes = blob.download_as_string()
logger.debug(f"File {source_blob_name} got from bucket {bucket_name}.")
return file_as_bytes, blob.content_type
......@@ -144,7 +144,7 @@ class TestGoogleCloudStorageClient:
@pytest.mark.parametrize("uri, bucket_name, blob_name, content_type", [
pytest.param("gs://bucket_test/name_test", "bucket_test", "name_test", "text/html"),
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment