Loramanager fixes

- avoid console errors in python and JS code
- suppress localhost:9000/null links
This commit is contained in:
JeLuF 2023-09-14 23:15:27 +02:00
parent c13d1093ee
commit 6311b80474
2 changed files with 9 additions and 3 deletions

View File

@ -55,8 +55,13 @@ def init():
return bucketfiles return bucketfiles
else: else:
bucket_id = crud.get_bucket_by_path(db, path).id bucket = crud.get_bucket_by_path(db, path)
if bucket == None:
raise HTTPException(status_code=404, detail="Bucket not found")
bucket_id = bucket.id
bucketfile = db.query(models.BucketFile).filter(models.BucketFile.bucket_id == bucket_id, models.BucketFile.filename == filename).first() bucketfile = db.query(models.BucketFile).filter(models.BucketFile.bucket_id == bucket_id, models.BucketFile.filename == filename).first()
if bucketfile == None:
raise HTTPException(status_code=404, detail="File not found")
suffix = get_suffix_from_filename(filename) suffix = get_suffix_from_filename(filename)

View File

@ -645,8 +645,10 @@
} else { } else {
LoraUI.keywordsField.value = info.keywords.join("\n") LoraUI.keywordsField.value = info.keywords.join("\n")
LoraUI.notesField.value = info.notes LoraUI.notesField.value = info.notes
if ("civitai" in info) { if ("civitai" in info && info["civitai"] != null) {
LoraUI.showCivitaiLink(info.civitai) LoraUI.showCivitaiLink(info.civitai)
} else {
LoraUI.hideCivitaiLink()
} }
} }
}) })
@ -657,7 +659,6 @@
LoraUI.imagePlaceholder.classList.add("displayNone") LoraUI.imagePlaceholder.classList.add("displayNone")
}) })
.catch((error) => { .catch((error) => {
console.error("Caught error:", error)
LoraUI.image.classList.add("displayNone") LoraUI.image.classList.add("displayNone")
LoraUI.imagePlaceholder.classList.remove("displayNone") LoraUI.imagePlaceholder.classList.remove("displayNone")
}) })