Resolved issue mentioned by @JeLuF concerning paths

This commit is contained in:
ManInDark 2023-08-06 21:52:01 +02:00
parent 44082b83fc
commit 3cc951cdaa
No known key found for this signature in database
GPG Key ID: 72EC12A5B2D62779

View File

@ -8,6 +8,7 @@ from easydiffusion.easydb import crud, models, schemas
from easydiffusion.easydb.database import SessionLocal, engine from easydiffusion.easydb.database import SessionLocal, engine
from requests.compat import urlparse from requests.compat import urlparse
from os.path import abspath
import base64, json import base64, json
@ -92,7 +93,7 @@ def init():
@server_api.get("/image/{image_path:path}") @server_api.get("/image/{image_path:path}")
def get_image(image_path: str, db: Session = Depends(get_db)): def get_image(image_path: str, db: Session = Depends(get_db)):
from easydiffusion.easydb.mappings import Image from easydiffusion.easydb.mappings import Image
image_path = image_path.replace("/", "\\") image_path = str(abspath(image_path))
amount = len(db.query(Image).filter(Image.path == image_path).all()) amount = len(db.query(Image).filter(Image.path == image_path).all())
if amount > 0: if amount > 0:
image = db.query(Image).filter(Image.path == image_path).first() image = db.query(Image).filter(Image.path == image_path).first()