[civitai] provide proper 'extension' for model files (#7432)

This commit is contained in:
Mike Fährmann
2025-05-04 17:34:06 +02:00
parent 25e293c16f
commit 3799369248
2 changed files with 10 additions and 6 deletions

View File

@@ -235,16 +235,20 @@ class CivitaiModelExtractor(CivitaiExtractor):
files = []
for num, file in enumerate(version["files"], 1):
name, sep, ext = file["name"].rpartition(".")
if not sep:
name = ext
ext = "bin"
file["uuid"] = "model-{}-{}-{}".format(
model["id"], version["id"], file["id"])
files.append({
"num" : num,
"file" : file,
"filename" : file["name"],
"extension": "bin",
"url" : file.get("downloadUrl") or
"{}/api/download/models/{}".format(
self.root, version["id"]),
"filename" : name,
"extension": ext,
"url" : (file.get("downloadUrl") or
"{}/api/download/models/{}".format(
self.root, version["id"])),
"_http_headers" : {
"Authorization": self.api.headers.get("Authorization")},
"_http_validate": self._validate_file_model,

View File

@@ -6,5 +6,5 @@
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
__version__ = "1.29.6"
__version__ = "1.29.7-dev"
__variant__ = None