File tree 1 file changed +4
-2
lines changed
projects/fal/src/fal/toolkit/utils
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -74,8 +74,6 @@ def _get_remote_file_properties(
74
74
with urlopen (request ) as response :
75
75
file_name = response .headers .get_filename ()
76
76
content_length = int (response .headers .get ("Content-Length" , - 1 ))
77
- # file name can contain a forward slash
78
- file_name = Path (file_name ).name
79
77
80
78
if not file_name :
81
79
parsed_url = urlparse (url )
@@ -86,6 +84,9 @@ def _get_remote_file_properties(
86
84
url_path = parsed_url .path
87
85
file_name = Path (url_path ).name or _hash_url (url )
88
86
87
+ # file name can still contain a forward slash if the server returns a relative path
88
+ file_name = Path (file_name ).name
89
+
89
90
return file_name , content_length
90
91
91
92
@@ -161,6 +162,7 @@ def download_file(
161
162
try :
162
163
file_name = _get_remote_file_properties (url , request_headers )[0 ]
163
164
except Exception as e :
165
+ print (f"GOt error: { e } " )
164
166
raise DownloadError (f"Failed to get remote file properties for { url } " ) from e
165
167
166
168
if "/" in file_name :
You can’t perform that action at this time.
0 commit comments