Risoluzione URL RFC 3986: fix sottopath raddoppiato (/calibre/calibre) + messaggio chiaro per risposte HTML
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user