John6666 commited on
Commit
1ee8bb8
1 Parent(s): 0ca70bf

Update utils.py

Browse files

Prevents the downloaded file name from Civitai becoming a zip file of training data.

Files changed (1) hide show
  1. utils.py +1 -1
utils.py CHANGED
@@ -62,7 +62,7 @@ class ModelInformation:
62
  self.download_url = json_data.get("downloadUrl", "")
63
  self.model_url = f"https://civitai.com/models/{self.model_id}?modelVersionId={self.model_version_id}"
64
  self.filename_url = next(
65
- (v.get("name", "") for v in json_data.get("files", []) if str(self.model_version_id) in v.get("downloadUrl", "")), ""
66
  )
67
  self.filename_url = self.filename_url if self.filename_url else ""
68
  self.description = json_data.get("description", "")
 
62
  self.download_url = json_data.get("downloadUrl", "")
63
  self.model_url = f"https://civitai.com/models/{self.model_id}?modelVersionId={self.model_version_id}"
64
  self.filename_url = next(
65
+ (v.get("name", "") for v in reversed(json_data.get("files", [])) if str(self.model_version_id) in v.get("downloadUrl", "")), ""
66
  )
67
  self.filename_url = self.filename_url if self.filename_url else ""
68
  self.description = json_data.get("description", "")