@remix-run/router 0.0.0-experimental-cf9637ce → 0.0.0-experimental-e7e9ce6e

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/router v0.0.0-experimental-cf9637ce
2
+ * @remix-run/router v0.0.0-experimental-e7e9ce6e
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 newOrigin = init.history.createURL(redirect.location).origin;
2562
+ let url = init.history.createURL(redirect.location);
2563
+ let isDifferentBasename = stripBasename(url.pathname, init.basename || "/") == null;
2563
2564
 
2564
- if (window.location.origin !== newOrigin) {
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 redirects.
3600
- // If this is a static reques, we can let it go back to the browser
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.
@@ -4098,6 +4100,7 @@
4098
4100
  exports.UNSAFE_DeferredData = DeferredData;
4099
4101
  exports.UNSAFE_convertRoutesToDataRoutes = convertRoutesToDataRoutes;
4100
4102
  exports.UNSAFE_getPathContributingMatches = getPathContributingMatches;
4103
+ exports.UNSAFE_invariant = invariant;
4101
4104
  exports.createBrowserHistory = createBrowserHistory;
4102
4105
  exports.createHashHistory = createHashHistory;
4103
4106
  exports.createMemoryHistory = createMemoryHistory;
@@ -4108,7 +4111,6 @@
4108
4111
  exports.generatePath = generatePath;
4109
4112
  exports.getStaticContextFromError = getStaticContextFromError;
4110
4113
  exports.getToPathname = getToPathname;
4111
- exports.invariant = invariant;
4112
4114
  exports.isRouteErrorResponse = isRouteErrorResponse;
4113
4115
  exports.joinPaths = joinPaths;
4114
4116
  exports.json = json;