bupa1018 commited on
Commit
312e934
·
1 Parent(s): fa8d129

Update download_repo.py

Browse files
Files changed (1) hide show
  1. download_repo.py +7 -8
download_repo.py CHANGED
@@ -13,21 +13,20 @@ 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
  response = requests.get(url)
16
- if response.status_code == 200:
17
-
18
 
19
- content_disposition = response.headers.get('content-disposition')
20
- if content_disposition:
21
- filename = content_disposition.split('filename=')[-1].strip('\"')
22
- else:
23
- filename = 'archive.zip' # Fallback to a default name if not found
24
 
25
  existing_files = api.list_repo_files(repo_id=HF_SPACE_NAME, repo_type='space')
26
  target_path = f"{target_folder}/{filename}"
27
 
28
  print(f"Target Path: '{target_path}'")
29
  print(f"Existing Files: {[repr(file) for file in existing_files]}")
30
-
31
  if target_path in existing_files:
32
  print(f"File '{target_path}' already exists in the repository. Skipping upload...")
33
  else:
 
13
  # Send GET request to download the zip file
14
  # response = requests.get(url, stream=True)
15
  response = requests.get(url)
16
+ if response.status_code == 200:
 
17
 
18
+ content_disposition = response.headers.get('content-disposition')
19
+ if content_disposition:
20
+ filename = content_disposition.split('filename=')[-1].strip('\"')
21
+ else:
22
+ filename = 'archive.zip' # Fallback to a default name if not found
23
 
24
  existing_files = api.list_repo_files(repo_id=HF_SPACE_NAME, repo_type='space')
25
  target_path = f"{target_folder}/{filename}"
26
 
27
  print(f"Target Path: '{target_path}'")
28
  print(f"Existing Files: {[repr(file) for file in existing_files]}")
29
+
30
  if target_path in existing_files:
31
  print(f"File '{target_path}' already exists in the repository. Skipping upload...")
32
  else: