diff --git a/storage3/_sync/file_api.py b/storage3/_sync/file_api.py index 90dbe77b..1ada349d 100644 --- a/storage3/_sync/file_api.py +++ b/storage3/_sync/file_api.py @@ -4,7 +4,7 @@ from dataclasses import dataclass, field from io import BufferedReader, FileIO from pathlib import Path -from typing import Any, Optional, Union, cast +from typing import Any, Optional, Union from httpx import HTTPError, Response @@ -167,9 +167,10 @@ def create_signed_url( json=json, ) data = response.json() - data[ - "signedURL" - ] = f"{self._client.base_url}{cast(str, data['signedURL']).lstrip('/')}" + if data['signedURL']: + data[ + "signedURL" + ] = f"{self._client.base_url}{str, data['signedURL'].lstrip('/')}" return data def create_signed_urls( @@ -196,9 +197,10 @@ def create_signed_urls( ) data = response.json() for item in data: - item[ - "signedURL" - ] = f"{self._client.base_url}{cast(str, item['signedURL']).lstrip('/')}" + if item['signedURL']: + item[ + "signedURL" + ] = f"{self._client.base_url}{str, item['signedURL'].lstrip('/')}" return data def get_public_url(self, path: str, options: TransformOptions = {}) -> str: