fix: allow hosting hash apps from other html files (#14825)
authorEli <88557639+lishaduck@users.noreply.github.com>
Thu, 20 Nov 2025 19:48:30 +0000 (13:48 -0600)
committerGitHub <noreply@github.com>
Thu, 20 Nov 2025 19:48:30 +0000 (20:48 +0100)
Fixes #14824.

Simplify by just checking if we're still on the current pathname

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
.changeset/upset-parents-sniff.md [new file with mode: 0644]
packages/kit/src/runtime/client/utils.js

diff --git a/.changeset/upset-parents-sniff.md b/.changeset/upset-parents-sniff.md
new file mode 100644 (file)
index 0000000..25c2cd6
--- /dev/null
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+fix: allow hosting hash-based apps from non-index.html files
index c233ef9ae52f52ec3254ebb4d9c4d20fc23bb9fc..5c77c80d22f03e723f32f90793f1ff9cc6373de3 100644 (file)
@@ -317,16 +317,7 @@ export function is_external_url(url, base, hash_routing) {
        }
 
        if (hash_routing) {
-               if (url.pathname === base + '/' || url.pathname === base + '/index.html') {
-                       return false;
-               }
-
-               // be lenient if serving from filesystem
-               if (url.protocol === 'file:' && url.pathname.replace(/\/[^/]+\.html?$/, '') === base) {
-                       return false;
-               }
-
-               return true;
+               return url.pathname !== location.pathname;
        }
 
        return false;