Merge pull request #2927 from arkohut/tolerant-no-write-permission-for-static-dir

fix: tolerant no write permission for copy favicon to static dir
This commit is contained in:
Timothy Jaeryang Baek 2024-06-08 13:03:08 -07:00 committed by GitHub
commit 9b839e5c9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -306,7 +306,10 @@ STATIC_DIR = Path(os.getenv("STATIC_DIR", BACKEND_DIR / "static")).resolve()
frontend_favicon = FRONTEND_BUILD_DIR / "favicon.png" frontend_favicon = FRONTEND_BUILD_DIR / "favicon.png"
if frontend_favicon.exists(): if frontend_favicon.exists():
shutil.copyfile(frontend_favicon, STATIC_DIR / "favicon.png") try:
shutil.copyfile(frontend_favicon, STATIC_DIR / "favicon.png")
except PermissionError:
logging.error(f"No write permission to {STATIC_DIR / 'favicon.png'}")
else: else:
logging.warning(f"Frontend favicon not found at {frontend_favicon}") logging.warning(f"Frontend favicon not found at {frontend_favicon}")