fix(filebrowser_quantum): reset 1.x configs to the v2 default on upgrade

Old installs carry a config copied from a 1.x image default, whose
userDefaults layout v2 rejects as unknown fields. Deleting keys one by one
cannot cover every 1.x variant, so back the file up and start from the v2
default, which the script then fills in as on a fresh install.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
alexbelgium
2026-10-11 07:10:19 +02:00
parent c2bbc5b46a
commit 3a94f3c188
2 changed files with 8 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
## 2.0.0.1 (2026-10-11)
- Fix startup on 2.0.0 (fresh installs and upgrades): write the v2 config format (`http.port`/`listen`/`baseURL`, `server.database.path`), drop the deprecated `FILEBROWSER_DATABASE` variable, and migrate an existing 1.x `/config/database.db` to `/config/database.sqlite` on first start (#3109)
- Fix startup on 2.0.0 (fresh installs and upgrades): write the v2 config format (`http.port`/`listen`/`baseURL`, `server.database.path`) and drop the deprecated `FILEBROWSER_DATABASE` variable (#3109) - Upgrade from 1.x: the old `/config/config.yaml` is saved as `config.yaml.v1.bak` and replaced by the 2.0 default (1.x keys are rejected by 2.0), and the 1.x `/config/database.db` is migrated to `/config/database.sqlite` on first start
## 2.0.0 (2026-10-10)
- Update to latest version from gtsteffaniak/filebrowser (changelog : https://github.com/gtsteffaniak/filebrowser/releases)

View File

@@ -79,6 +79,13 @@ mkdir -p /var/log/nginx && touch /var/log/nginx/error.log
mkdir -p /config /cache
# A 1.x config (string server.database, written below before 2.0.0) holds keys
# that v2 rejects: keep a copy and start again from the v2 default
if [ -f "$FILEBROWSER_CONFIG" ] && [ "$(yq e '.server.database | tag' "$FILEBROWSER_CONFIG")" = "!!str" ]; then
bashio::log.warning "FileBrowser 1.x config saved to ${FILEBROWSER_CONFIG}.v1.bak, starting from the 2.0 default config"
mv "$FILEBROWSER_CONFIG" "${FILEBROWSER_CONFIG}.v1.bak"
fi
# Copy default config if not existing
if [ ! -f "$FILEBROWSER_CONFIG" ]; then
cp /home/filebrowser/data/config.yaml "$FILEBROWSER_CONFIG"
@@ -88,8 +95,6 @@ bashio::log.info "Updating FileBrowser config..."
# --- Server (hardcoded values) ---
bashio::log.info "... set server"
# v2 moved port/listen/baseURL under http: and rejects the 1.x keys
yq e -i "del(.server.port, .server.listen, .server.baseURL)" "$FILEBROWSER_CONFIG"
yq e -i ".http.port = 8080" "$FILEBROWSER_CONFIG"
yq e -i ".http.listen = \"0.0.0.0\"" "$FILEBROWSER_CONFIG"
yq e -i ".server.database = {\"path\": \"/config/database.sqlite\"}" "$FILEBROWSER_CONFIG"