Skip to content

Commit 19950f8

Browse files
committed
fix:
1 parent ec515b4 commit 19950f8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

projects/fal/src/fal/toolkit/utils/download_utils.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ def _get_remote_file_properties(
7474
with urlopen(request) as response:
7575
file_name = response.headers.get_filename()
7676
content_length = int(response.headers.get("Content-Length", -1))
77-
# file name can contain a forward slash
78-
file_name = Path(file_name).name
7977

8078
if not file_name:
8179
parsed_url = urlparse(url)
@@ -86,6 +84,9 @@ def _get_remote_file_properties(
8684
url_path = parsed_url.path
8785
file_name = Path(url_path).name or _hash_url(url)
8886

87+
# file name can still contain a forward slash if the server returns a relative path
88+
file_name = Path(file_name).name
89+
8990
return file_name, content_length
9091

9192

@@ -161,6 +162,7 @@ def download_file(
161162
try:
162163
file_name = _get_remote_file_properties(url, request_headers)[0]
163164
except Exception as e:
165+
print(f"GOt error: {e}")
164166
raise DownloadError(f"Failed to get remote file properties for {url}") from e
165167

166168
if "/" in file_name:

0 commit comments

Comments
 (0)