Risoluzione URL RFC 3986: fix sottopath raddoppiato (/calibre/calibre) + messaggio chiaro per risposte HTML

This commit is contained in:
2026-08-12 12:13:56 +02:00
parent dea79aff49
commit 62452b470e
2 changed files with 27 additions and 8 deletions
+5
View File
@@ -121,6 +121,11 @@ Page {
if (u.indexOf("http://") === 0 || u.indexOf("https://") === 0)
return u
var base = appSettings.baseUrl
// il server dietro sottopath (es. /calibre) emette link che lo includono già:
// evita di raddoppiarlo
var basePath = base.replace(/^https?:\/\/[^\/]+/, "")
if (basePath.length > 1 && u.indexOf(basePath) === 0)
return base + u.substring(basePath.length)
return base + (u.charAt(0) === "/" ? u : "/" + u)
}