mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-12 03:05:12 +00:00
Regularize page and server routes
Treats both page and server routes similarly in regards to indexes. It's a (somewhat) breaking change: server routes will accept trailing slashes to match page routes behavior, but only if there's no extension. We still need a stronger support for dealing with different clean urls rules.
This commit is contained in:
@@ -101,7 +101,11 @@ export function select_target(url: URL): Target {
|
||||
if (url.origin !== location.origin) return null;
|
||||
if (!url.pathname.startsWith(initial_data.baseUrl)) return null;
|
||||
|
||||
const path = url.pathname.slice(initial_data.baseUrl.length);
|
||||
let path = url.pathname.slice(initial_data.baseUrl.length);
|
||||
|
||||
if (path === '') {
|
||||
path = '/';
|
||||
}
|
||||
|
||||
// avoid accidental clashes between server routes and page routes
|
||||
if (ignore.some(pattern => pattern.test(path))) return;
|
||||
|
||||
Reference in New Issue
Block a user