bupa1018 commited on
Commit
dcbef97
·
1 Parent(s): 5ac357a

Update download_repo.py

Browse files
Files changed (1) hide show
  1. download_repo.py +5 -1
download_repo.py CHANGED
@@ -13,7 +13,11 @@ def download_gitlab_repo_to_hfspace(api_url, project_id, version, target_folder)
13
  # Send GET request to download the zip file
14
  response = requests.get(url, stream=True)
15
 
16
-
 
 
 
 
17
 
18
  existing_files = api.list_repo_files(repo_id=HF_SPACE_NAME, repo_type='space')
19
  target_path = f"{target_folder}/{filename}"
 
13
  # Send GET request to download the zip file
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}"