Spaces:
Runtime error
Runtime error
Update download_repo.py
Browse files- download_repo.py +4 -4
download_repo.py
CHANGED
|
@@ -14,10 +14,10 @@ def download_gitlab_repo_to_hfspace(api_url, project_id, version, target_folder)
|
|
| 14 |
response = requests.get(url, stream=True)
|
| 15 |
|
| 16 |
content_disposition = response.headers.get('content-disposition')
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
|
| 22 |
existing_files = api.list_repo_files(repo_id=HF_SPACE_NAME, repo_type='space')
|
| 23 |
target_path = f"{target_folder}/{filename}"
|
|
|
|
| 14 |
response = requests.get(url, stream=True)
|
| 15 |
|
| 16 |
content_disposition = response.headers.get('content-disposition')
|
| 17 |
+
if content_disposition:
|
| 18 |
+
filename = content_disposition.split('filename=')[-1].strip('\"')
|
| 19 |
+
else:
|
| 20 |
+
filename = 'archive.zip' # Fallback to a default name if not found
|
| 21 |
|
| 22 |
existing_files = api.list_repo_files(repo_id=HF_SPACE_NAME, repo_type='space')
|
| 23 |
target_path = f"{target_folder}/{filename}"
|