Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit db26dd9

Browse files
committed
Fix: FileResponse cannot be a folder
1 parent a49944d commit db26dd9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bookserver/routers/books.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ async def return_static_asset(course, kind, filepath):
8686
filepath,
8787
)
8888
rslogger.debug(f"GETTING: {filepath}")
89-
if os.path.exists(filepath):
89+
if os.path.exists(filepath) and not os.path.isdir(filepath):
9090
return FileResponse(filepath)
9191
else:
9292
raise HTTPException(404)
@@ -306,6 +306,9 @@ async def serve_page(
306306
rslogger.debug(f"After user check rs_banner is {show_rs_banner}")
307307

308308
worker_name = os.environ.get("WORKER_NAME", socket.gethostname())
309+
if worker_name == "":
310+
worker_name = socket.gethostname()
311+
309312
# temporary
310313
if course_attrs.get("ad_server", "google") == "ethical":
311314
serve_google_ad = False

0 commit comments

Comments
 (0)