fix: patch server-ui entrypoint to fix sed ordering bug
All checks were successful
CI / build (push) Successful in 1m19s
CI / docker (push) Successful in 9s

The server-ui's entrypoint inserts <base href> THEN rewrites all
href="/" — including the just-inserted base tag, causing doubling.
Patched entrypoint rewrites asset paths first, then inserts <base>.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-05 23:53:03 +02:00
parent 4c6625efaa
commit 5981a3db71
2 changed files with 23 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
#!/bin/sh
# Patched entrypoint: fixes the sed ordering bug in the server-ui image.
# The original entrypoint inserts <base href> then rewrites ALL href="/..."
# including the just-inserted base tag, causing /server/server/ doubling.
BASE_PATH="${BASE_PATH:-/}"
if [ "$BASE_PATH" != "/" ]; then
BASE_PATH=$(echo "$BASE_PATH" | sed 's#/*$#/#; s#^/*#/#')
INDEX="/usr/share/nginx/html/index.html"
# Rewrite absolute asset paths FIRST (before inserting <base>)
sed -i "s|href=\"/|href=\"${BASE_PATH}|g; s|src=\"/|src=\"${BASE_PATH}|g" "$INDEX"
# THEN inject <base> tag
sed -i "s|<head>|<head><base href=\"${BASE_PATH}\">|" "$INDEX"
echo "BASE_PATH set to ${BASE_PATH} — rewrote index.html"
fi
exec /docker-entrypoint.sh "$@"