mirror of
https://github.com/Physton/sd-webui-prompt-all-in-one.git
synced 2026-01-26 19:29:56 +00:00
fix bug
This commit is contained in:
@@ -340,7 +340,7 @@ def on_app_started(_: gr.Blocks, app: FastAPI):
|
||||
@app.get("/physton_prompt/styles")
|
||||
async def _styles(file: str):
|
||||
file_path = get_style_full_path(file)
|
||||
if not os.path.exists(file_path):
|
||||
if not file_path or not os.path.exists(file_path):
|
||||
return Response(status_code=404)
|
||||
return FileResponse(file_path, filename=os.path.basename(file_path))
|
||||
|
||||
|
||||
@@ -9,7 +9,14 @@ styles_path = os.path.normpath(styles_path)
|
||||
|
||||
def get_style_full_path(file):
|
||||
global styles_path
|
||||
return os.path.join(styles_path, file)
|
||||
path = os.path.join(styles_path, file)
|
||||
path = os.path.abspath(path)
|
||||
path = os.path.normpath(path)
|
||||
if not os.path.exists(path):
|
||||
return None
|
||||
if styles_path not in path:
|
||||
return None
|
||||
return path
|
||||
|
||||
|
||||
def get_extension_css_list():
|
||||
|
||||
Reference in New Issue
Block a user