@remix-run/router 1.3.3-pre.0 → 1.3.3-pre.1
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 +6 -0
- 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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# `@remix-run/router`
|
|
2
2
|
|
|
3
|
+
## 1.3.3-pre.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Correctly perform a "hard" redirect for same-origin absolute URLs outside of the router basename ([#10076](https://github.com/remix-run/react-router/pull/10076))
|
|
8
|
+
|
|
3
9
|
## 1.3.3-pre.0
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/router.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.3.3-pre.
|
|
2
|
+
* @remix-run/router v1.3.3-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2557,9 +2557,10 @@ function createRouter(init) {
|
|
|
2557
2557
|
invariant(redirectLocation, "Expected a location on the redirect navigation"); // Check if this an absolute external redirect that goes to a new origin
|
|
2558
2558
|
|
|
2559
2559
|
if (ABSOLUTE_URL_REGEX.test(redirect.location) && isBrowser && typeof ((_window = window) == null ? void 0 : _window.location) !== "undefined") {
|
|
2560
|
-
let
|
|
2560
|
+
let url = init.history.createURL(redirect.location);
|
|
2561
|
+
let isDifferentBasename = stripBasename(url.pathname, init.basename || "/") == null;
|
|
2561
2562
|
|
|
2562
|
-
if (window.location.origin !==
|
|
2563
|
+
if (window.location.origin !== url.origin || isDifferentBasename) {
|
|
2563
2564
|
if (replace) {
|
|
2564
2565
|
window.location.replace(redirect.location);
|
|
2565
2566
|
} else {
|
|
@@ -3594,13 +3595,14 @@ async function callLoaderOrAction(type, request, match, matches, basename, isSta
|
|
|
3594
3595
|
|
|
3595
3596
|
location = createPath(resolvedLocation);
|
|
3596
3597
|
} else if (!isStaticRequest) {
|
|
3597
|
-
// Strip off the protocol+origin for same-origin absolute
|
|
3598
|
-
// If this is a static
|
|
3599
|
-
// as-is
|
|
3598
|
+
// Strip off the protocol+origin for same-origin + same-basename absolute
|
|
3599
|
+
// redirects. If this is a static request, we can let it go back to the
|
|
3600
|
+
// browser as-is
|
|
3600
3601
|
let currentUrl = new URL(request.url);
|
|
3601
3602
|
let url = location.startsWith("//") ? new URL(currentUrl.protocol + location) : new URL(location);
|
|
3603
|
+
let isSameBasename = stripBasename(url.pathname, basename) != null;
|
|
3602
3604
|
|
|
3603
|
-
if (url.origin === currentUrl.origin) {
|
|
3605
|
+
if (url.origin === currentUrl.origin && isSameBasename) {
|
|
3604
3606
|
location = url.pathname + url.search + url.hash;
|
|
3605
3607
|
}
|
|
3606
3608
|
} // Don't process redirects in the router during static requests requests.
|