mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-06-02 02:15:34 +08:00
fix: ignore cross-origin basename hints
This commit is contained in:
@@ -38,7 +38,12 @@ function detectRouterBasename() {
|
||||
let detectedBasename = '';
|
||||
for (const candidate of candidatePaths) {
|
||||
try {
|
||||
const pathname = new URL(candidate.value, document.baseURI || window.location.href).pathname;
|
||||
const candidateUrl = new URL(candidate.value, document.baseURI || window.location.href);
|
||||
if (candidateUrl.origin !== window.location.origin) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const pathname = candidateUrl.pathname;
|
||||
const normalizedPathname = pathname.replace(/\/+$/, '');
|
||||
|
||||
let normalized = '';
|
||||
@@ -53,7 +58,7 @@ function detectRouterBasename() {
|
||||
const match = candidate.kind === 'manifest' ? manifestMatch : iconMatch;
|
||||
if (match?.[1]) {
|
||||
const segments = match[1].split('/').filter(Boolean);
|
||||
while (segments.length > 0 && ['assets', 'static', 'icons', 'images'].includes(segments[segments.length - 1])) {
|
||||
while (segments.length > 1 && ['assets', 'static', 'icons', 'images'].includes(segments[segments.length - 1])) {
|
||||
segments.pop();
|
||||
}
|
||||
normalized = segments.length > 0 ? `/${segments.join('/')}` : '';
|
||||
|
||||
Reference in New Issue
Block a user