From 96458e58b62b5fe588ad527760a4a2c8c53b986e Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Thu, 24 Sep 2026 10:48:16 +0200 Subject: [PATCH] fix: keep tracked static files when the frontend is not built Importing the config module in a source checkout without a frontend build deleted 17 tracked files from the backend static folder (favicons, logo, custom.css, loader.js, user.png and more). The cleanup that clears old static files ran every time, but the copy that refills the folder only runs when a frontend build exists. Anything that imports the backend without running the build first (pytest, a language server, running the backend alone) left a dirty git tree and a backend with no favicon, logo or default avatar. The cleanup now only runs when a frontend build is present, so clearing and refilling happen together or not at all. Docker images, pip installs and dev setups that run the build first behave exactly as before. Fixes #29968 --- backend/open_webui/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/config.py b/backend/open_webui/config.py index 897618247a..ece36cf0fe 100644 --- a/backend/open_webui/config.py +++ b/backend/open_webui/config.py @@ -98,7 +98,7 @@ async def import_legacy_config_json(): STATIC_DIR = Path(os.getenv('STATIC_DIR', OPEN_WEBUI_DIR / 'static')).resolve() try: - if STATIC_DIR.exists(): + if STATIC_DIR.exists() and (FRONTEND_BUILD_DIR / 'static').is_dir(): for item in STATIC_DIR.iterdir(): if item.is_file() or item.is_symlink(): try: