@remix-run/router 1.3.3-pre.0 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -2
- package/dist/router.cjs.js +9 -7
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.js +9 -7
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +9 -7
- package/dist/router.umd.js.map +1 -1
- package/dist/router.umd.min.js +2 -2
- package/dist/router.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/router.ts +11 -7
package/dist/router.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.3.3
|
|
2
|
+
* @remix-run/router v1.3.3
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2559,9 +2559,10 @@
|
|
|
2559
2559
|
invariant(redirectLocation, "Expected a location on the redirect navigation"); // Check if this an absolute external redirect that goes to a new origin
|
|
2560
2560
|
|
|
2561
2561
|
if (ABSOLUTE_URL_REGEX.test(redirect.location) && isBrowser && typeof ((_window = window) == null ? void 0 : _window.location) !== "undefined") {
|
|
2562
|
-
let
|
|
2562
|
+
let url = init.history.createURL(redirect.location);
|
|
2563
|
+
let isDifferentBasename = stripBasename(url.pathname, init.basename || "/") == null;
|
|
2563
2564
|
|
|
2564
|
-
if (window.location.origin !==
|
|
2565
|
+
if (window.location.origin !== url.origin || isDifferentBasename) {
|
|
2565
2566
|
if (replace) {
|
|
2566
2567
|
window.location.replace(redirect.location);
|
|
2567
2568
|
} else {
|
|
@@ -3596,13 +3597,14 @@
|
|
|
3596
3597
|
|
|
3597
3598
|
location = createPath(resolvedLocation);
|
|
3598
3599
|
} else if (!isStaticRequest) {
|
|
3599
|
-
// Strip off the protocol+origin for same-origin absolute
|
|
3600
|
-
// If this is a static
|
|
3601
|
-
// as-is
|
|
3600
|
+
// Strip off the protocol+origin for same-origin + same-basename absolute
|
|
3601
|
+
// redirects. If this is a static request, we can let it go back to the
|
|
3602
|
+
// browser as-is
|
|
3602
3603
|
let currentUrl = new URL(request.url);
|
|
3603
3604
|
let url = location.startsWith("//") ? new URL(currentUrl.protocol + location) : new URL(location);
|
|
3605
|
+
let isSameBasename = stripBasename(url.pathname, basename) != null;
|
|
3604
3606
|
|
|
3605
|
-
if (url.origin === currentUrl.origin) {
|
|
3607
|
+
if (url.origin === currentUrl.origin && isSameBasename) {
|
|
3606
3608
|
location = url.pathname + url.search + url.hash;
|
|
3607
3609
|
}
|
|
3608
3610
|
} // Don't process redirects in the router during static requests requests.
|