Skip to content

Commit ab5a812

Browse files
committed
i
1 parent 298ccb8 commit ab5a812

7 files changed

Lines changed: 12 additions & 14 deletions

File tree

dist/404.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@
2828
const pathSegmentsToKeep = 0;
2929
const l = new URL(window.location);
3030
const decodedPath = decodeURIComponent(l.pathname);
31-
if (!decodedPath.includes('?/') && !l.search.startsWith('?/')) {
31+
if (!decodedPath.includes('//')) {
3232
const basePath = '/' + l.pathname.split('/').slice(1, 1 + pathSegmentsToKeep).join('/');
3333
const restPath = l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/');
34-
const newPath = basePath + (basePath.endsWith('/') ? '' : '/') + '?/' + restPath.replace(/&/g, '~and~');
35-
const newSearch = l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '';
36-
window.location.replace(l.origin + newPath + newSearch + l.hash);
34+
const newPath = basePath + (basePath.endsWith('/') ? '/' : '//') + restPath;
35+
window.location.replace(l.origin + newPath + l.search + l.hash);
3736
}
3837
})();
3938
</script></head><body></body></html>

dist/bundle-22c92.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

dist/bundle-9c596.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/404.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@
2828
const pathSegmentsToKeep = 0;
2929
const l = new URL(window.location);
3030
const decodedPath = decodeURIComponent(l.pathname);
31-
if (!decodedPath.includes('?/') && !l.search.startsWith('?/')) {
31+
if (!decodedPath.includes('//')) {
3232
const basePath = '/' + l.pathname.split('/').slice(1, 1 + pathSegmentsToKeep).join('/');
3333
const restPath = l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/');
34-
const newPath = basePath + (basePath.endsWith('/') ? '' : '/') + '?/' + restPath.replace(/&/g, '~and~');
35-
const newSearch = l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '';
36-
window.location.replace(l.origin + newPath + newSearch + l.hash);
34+
const newPath = basePath + (basePath.endsWith('/') ? '/' : '//') + restPath;
35+
window.location.replace(l.origin + newPath + l.search + l.hash);
3736
}
3837
})();
3938
</script></head><body></body></html>

src/js/github-pages.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// the single page app to route accordingly.
1212

1313
// Updated to modern syntax in 2024 for https://github.com/i1li/i
14-
if (window.location.search.startsWith('?/')) {
15-
const decoded = window.location.search.slice(1).split('&').map(s => s.replace(/~and~/g, '&')).join('?');
16-
window.history.replaceState(null, null, window.location.origin + decoded + window.location.hash);
14+
if (window.location.search.startsWith('//')) {
15+
const decoded = window.location.search.slice(2);
16+
window.history.replaceState(null, null, window.location.origin + '/' + decoded + window.location.hash);
1717
}

0 commit comments

Comments
 (0)