react-router 7.18.2 → 7.18.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 +8 -0
- package/dist/development/{browser-DBmQ1yAR.d.mts → browser-BR5QG7ZC.d.mts} +1 -1
- package/dist/development/{browser-B2PdsXXH.d.ts → browser-eq4RgLsD.d.ts} +1 -1
- package/dist/development/{chunk-HHGH3NKS.js → chunk-7SIULPXI.js} +117 -18
- package/dist/development/{chunk-62JRHF6Z.mjs → chunk-BV7QT456.mjs} +112 -13
- package/dist/development/{chunk-ZA36QIGN.mjs → chunk-HT4INDD5.mjs} +13 -6
- package/dist/{production/chunk-VJZ67BZE.js → development/chunk-QPXIKN46.js} +7 -7
- package/dist/development/{chunk-7XGYIT3M.js → chunk-YRTY65LJ.js} +103 -103
- package/dist/{production/context-CeD5LmaF.d.mts → development/context-nqAapj74.d.mts} +9 -0
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.d.ts +2 -2
- package/dist/development/dom-export.js +45 -32
- package/dist/development/dom-export.mjs +17 -4
- package/dist/{production/index-react-server-client-3ykjivgQ.d.ts → development/index-react-server-client-BjY-eKuf.d.ts} +2 -1
- package/dist/{production/index-react-server-client-CACgcj2J.d.mts → development/index-react-server-client-K63fpMH4.d.mts} +1 -1
- package/dist/development/index-react-server-client.d.mts +2 -2
- package/dist/development/index-react-server-client.d.ts +2 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +8 -0
- package/dist/development/index-react-server.d.ts +8 -0
- package/dist/development/index-react-server.js +25 -9
- package/dist/development/index-react-server.mjs +25 -9
- package/dist/development/index.d.mts +6 -6
- package/dist/development/index.d.ts +6 -6
- package/dist/development/index.js +101 -94
- package/dist/development/index.mjs +3 -3
- package/dist/{production/instrumentation-Dkmpzd13.d.ts → development/instrumentation-B7w3_Eo9.d.ts} +8 -0
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/production/{browser-DBmQ1yAR.d.mts → browser-BR5QG7ZC.d.mts} +1 -1
- package/dist/production/{browser-B2PdsXXH.d.ts → browser-eq4RgLsD.d.ts} +1 -1
- package/dist/production/{chunk-TP6EHSSF.js → chunk-6XRGXNVQ.js} +117 -18
- package/dist/production/{chunk-YBLPXYCV.mjs → chunk-EFMJ2SG4.mjs} +112 -13
- package/dist/production/{chunk-FDTIF24W.js → chunk-LNBCQR6O.js} +103 -103
- package/dist/{development/chunk-3UVS743K.js → production/chunk-SJHDA7OG.js} +7 -7
- package/dist/production/{chunk-SJTG3J2Q.mjs → chunk-UODOIDHR.mjs} +13 -6
- package/dist/{development/context-CeD5LmaF.d.mts → production/context-nqAapj74.d.mts} +9 -0
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.d.ts +2 -2
- package/dist/production/dom-export.js +45 -32
- package/dist/production/dom-export.mjs +17 -4
- package/dist/{development/index-react-server-client-3ykjivgQ.d.ts → production/index-react-server-client-BjY-eKuf.d.ts} +2 -1
- package/dist/{development/index-react-server-client-CACgcj2J.d.mts → production/index-react-server-client-K63fpMH4.d.mts} +1 -1
- package/dist/production/index-react-server-client.d.mts +2 -2
- package/dist/production/index-react-server-client.d.ts +2 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +8 -0
- package/dist/production/index-react-server.d.ts +8 -0
- package/dist/production/index-react-server.js +25 -9
- package/dist/production/index-react-server.mjs +25 -9
- package/dist/production/index.d.mts +6 -6
- package/dist/production/index.d.ts +6 -6
- package/dist/production/index.js +101 -94
- package/dist/production/index.mjs +3 -3
- package/dist/{development/instrumentation-Dkmpzd13.d.ts → production/instrumentation-B7w3_Eo9.d.ts} +8 -0
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/package.json +1 -1
|
@@ -207,6 +207,14 @@ interface Router$1 {
|
|
|
207
207
|
* @param location
|
|
208
208
|
*/
|
|
209
209
|
createHref(location: Location | URL): string;
|
|
210
|
+
/**
|
|
211
|
+
* @private
|
|
212
|
+
* PRIVATE - DO NOT USE
|
|
213
|
+
*
|
|
214
|
+
* Utility function to create a URL for the given location
|
|
215
|
+
* @param location
|
|
216
|
+
*/
|
|
217
|
+
createURL?(to: To): URL;
|
|
210
218
|
/**
|
|
211
219
|
* @private
|
|
212
220
|
* PRIVATE - DO NOT USE
|
|
@@ -1751,6 +1759,7 @@ interface NavigateOptions {
|
|
|
1751
1759
|
*/
|
|
1752
1760
|
interface Navigator {
|
|
1753
1761
|
createHref: History["createHref"];
|
|
1762
|
+
createURL?: History["createURL"];
|
|
1754
1763
|
encodeLocation?: History["encodeLocation"];
|
|
1755
1764
|
go: History["go"];
|
|
1756
1765
|
push(to: To, state?: any, opts?: NavigateOptions): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { a as RouterProviderProps$1, R as RouterInit, C as ClientInstrumentation, b as ClientOnErrorFunction } from './context-
|
|
3
|
-
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-
|
|
2
|
+
import { a as RouterProviderProps$1, R as RouterInit, C as ClientInstrumentation, b as ClientOnErrorFunction } from './context-nqAapj74.mjs';
|
|
3
|
+
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-BR5QG7ZC.mjs';
|
|
4
4
|
import './data-DEjBmEfD.mjs';
|
|
5
5
|
|
|
6
6
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RouterProviderProps as RouterProviderProps$1, RouterInit, ClientOnErrorFunction } from 'react-router';
|
|
3
|
-
import { C as ClientInstrumentation } from './instrumentation-
|
|
4
|
-
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-
|
|
3
|
+
import { C as ClientInstrumentation } from './instrumentation-B7w3_Eo9.js';
|
|
4
|
+
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-eq4RgLsD.js';
|
|
5
5
|
import './data-CjO11-hU.js';
|
|
6
6
|
|
|
7
7
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
-
* react-router v7.18.
|
|
2
|
+
* react-router v7.18.3
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkQPXIKN46js = require('./chunk-QPXIKN46.js');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -37,7 +37,8 @@ var _chunk3UVS743Kjs = require('./chunk-3UVS743K.js');
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
var _chunk7SIULPXIjs = require('./chunk-7SIULPXI.js');
|
|
41
42
|
|
|
42
43
|
// lib/dom-export/dom-router-provider.tsx
|
|
43
44
|
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
|
|
@@ -213,7 +214,7 @@ function HydratedRouter(props) {
|
|
|
213
214
|
}, []);
|
|
214
215
|
React2.useEffect(() => {
|
|
215
216
|
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
|
|
216
|
-
document.querySelectorAll(`[${
|
|
217
|
+
document.querySelectorAll(`[${_chunk7SIULPXIjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
|
|
217
218
|
}
|
|
218
219
|
}, [criticalCss]);
|
|
219
220
|
let [location2, setLocation] = React2.useState(router.state.location);
|
|
@@ -307,8 +308,14 @@ function createCallServer({
|
|
|
307
308
|
Promise.resolve(payloadPromise).then(async (payload) => {
|
|
308
309
|
if (payload.type === "redirect") {
|
|
309
310
|
let location2 = normalizeRedirectLocation(payload.location);
|
|
311
|
+
_chunk7SIULPXIjs.validateNavigationTarget.call(void 0,
|
|
312
|
+
payload.location,
|
|
313
|
+
location2,
|
|
314
|
+
new URL(window.location.href),
|
|
315
|
+
"allow-explicit"
|
|
316
|
+
);
|
|
310
317
|
if (payload.reload || isExternalLocation(location2)) {
|
|
311
|
-
if (
|
|
318
|
+
if (_chunk7SIULPXIjs.hasInvalidProtocol.call(void 0, location2)) {
|
|
312
319
|
throw new Error("Invalid redirect location");
|
|
313
320
|
}
|
|
314
321
|
window.location.href = location2;
|
|
@@ -328,8 +335,14 @@ function createCallServer({
|
|
|
328
335
|
if (rerender && landedActionId < actionId && globalVar.__routerActionID <= actionId) {
|
|
329
336
|
if (rerender.type === "redirect") {
|
|
330
337
|
let location2 = normalizeRedirectLocation(rerender.location);
|
|
338
|
+
_chunk7SIULPXIjs.validateNavigationTarget.call(void 0,
|
|
339
|
+
rerender.location,
|
|
340
|
+
location2,
|
|
341
|
+
new URL(window.location.href),
|
|
342
|
+
"allow-explicit"
|
|
343
|
+
);
|
|
331
344
|
if (rerender.reload || isExternalLocation(location2)) {
|
|
332
|
-
if (
|
|
345
|
+
if (_chunk7SIULPXIjs.hasInvalidProtocol.call(void 0, location2)) {
|
|
333
346
|
throw new Error("Invalid redirect location");
|
|
334
347
|
}
|
|
335
348
|
window.location.href = location2;
|
|
@@ -394,7 +407,7 @@ function createRouterFromPayload({
|
|
|
394
407
|
};
|
|
395
408
|
if (payload.type !== "render") throw new Error("Invalid payload type");
|
|
396
409
|
globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {}));
|
|
397
|
-
|
|
410
|
+
_chunkQPXIKN46js.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
|
|
398
411
|
let routes = payload.matches.reduceRight((previous, match) => {
|
|
399
412
|
const route = createRouteFromServerManifest(
|
|
400
413
|
match,
|
|
@@ -408,12 +421,12 @@ function createRouterFromPayload({
|
|
|
408
421
|
return [route];
|
|
409
422
|
}, []);
|
|
410
423
|
let applyPatchesPromise;
|
|
411
|
-
globalVar.__reactRouterDataRouter =
|
|
424
|
+
globalVar.__reactRouterDataRouter = _chunk7SIULPXIjs.createRouter.call(void 0, {
|
|
412
425
|
routes,
|
|
413
426
|
getContext,
|
|
414
427
|
basename: payload.basename,
|
|
415
|
-
history:
|
|
416
|
-
hydrationData:
|
|
428
|
+
history: _chunk7SIULPXIjs.createBrowserHistory.call(void 0, ),
|
|
429
|
+
hydrationData: _chunkQPXIKN46js.getHydrationData.call(void 0, {
|
|
417
430
|
state: {
|
|
418
431
|
loaderData: payload.loaderData,
|
|
419
432
|
actionData: payload.actionData,
|
|
@@ -422,7 +435,7 @@ function createRouterFromPayload({
|
|
|
422
435
|
routes,
|
|
423
436
|
getRouteInfo: (routeId) => {
|
|
424
437
|
let match = payload.matches.find((m) => m.id === routeId);
|
|
425
|
-
|
|
438
|
+
_chunk7SIULPXIjs.invariant.call(void 0, match, "Route not found in payload");
|
|
426
439
|
return {
|
|
427
440
|
clientLoader: match.clientLoader,
|
|
428
441
|
hasLoader: match.hasLoader,
|
|
@@ -537,9 +550,9 @@ function createRouterFromPayload({
|
|
|
537
550
|
routeModules: globalVar.__reactRouterRouteModules
|
|
538
551
|
};
|
|
539
552
|
}
|
|
540
|
-
var renderedRoutesContext =
|
|
553
|
+
var renderedRoutesContext = _chunk7SIULPXIjs.createContext.call(void 0, );
|
|
541
554
|
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
|
|
542
|
-
let dataStrategy =
|
|
555
|
+
let dataStrategy = _chunk7SIULPXIjs.getSingleFetchDataStrategyImpl.call(void 0,
|
|
543
556
|
getRouter,
|
|
544
557
|
(match) => {
|
|
545
558
|
let M = match;
|
|
@@ -596,20 +609,20 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
|
|
596
609
|
function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
|
|
597
610
|
return async (args, basename, trailingSlashAware, targetRoutes) => {
|
|
598
611
|
let { request, context } = args;
|
|
599
|
-
let url =
|
|
612
|
+
let url = _chunk7SIULPXIjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
|
|
600
613
|
if (request.method === "GET") {
|
|
601
|
-
url =
|
|
614
|
+
url = _chunk7SIULPXIjs.stripIndexParam.call(void 0, url);
|
|
602
615
|
if (targetRoutes) {
|
|
603
616
|
url.searchParams.set("_routes", targetRoutes.join(","));
|
|
604
617
|
}
|
|
605
618
|
}
|
|
606
619
|
let res = await fetchImplementation(
|
|
607
|
-
new Request(url, await
|
|
620
|
+
new Request(url, await _chunk7SIULPXIjs.createRequestInit.call(void 0, request))
|
|
608
621
|
);
|
|
609
622
|
if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
|
|
610
|
-
throw new (0,
|
|
623
|
+
throw new (0, _chunk7SIULPXIjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
|
|
611
624
|
}
|
|
612
|
-
|
|
625
|
+
_chunk7SIULPXIjs.invariant.call(void 0, res.body, "No response body to decode");
|
|
613
626
|
try {
|
|
614
627
|
const payload = await createFromReadableStream(res.body, {
|
|
615
628
|
temporaryReferences: void 0
|
|
@@ -633,7 +646,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
|
|
|
633
646
|
}
|
|
634
647
|
context.get(renderedRoutesContext).push(...payload.matches);
|
|
635
648
|
let results = { routes: {} };
|
|
636
|
-
const dataKey =
|
|
649
|
+
const dataKey = _chunk7SIULPXIjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
|
|
637
650
|
for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {
|
|
638
651
|
results.routes[routeId] = { data };
|
|
639
652
|
}
|
|
@@ -666,7 +679,7 @@ function RSCHydratedRouter({
|
|
|
666
679
|
[createFromReadableStream, payload, fetchImplementation, getContext]
|
|
667
680
|
);
|
|
668
681
|
React3.useEffect(() => {
|
|
669
|
-
|
|
682
|
+
_chunk7SIULPXIjs.setIsHydrated.call(void 0, );
|
|
670
683
|
}, []);
|
|
671
684
|
React3.useLayoutEffect(() => {
|
|
672
685
|
const globalVar = window;
|
|
@@ -774,8 +787,8 @@ function RSCHydratedRouter({
|
|
|
774
787
|
},
|
|
775
788
|
routeModules
|
|
776
789
|
};
|
|
777
|
-
return /* @__PURE__ */ React3.createElement(
|
|
778
|
-
|
|
790
|
+
return /* @__PURE__ */ React3.createElement(_chunk7SIULPXIjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkQPXIKN46js.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunk7SIULPXIjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
|
|
791
|
+
_chunk7SIULPXIjs.RouterProvider,
|
|
779
792
|
{
|
|
780
793
|
router: transitionEnabledRouter,
|
|
781
794
|
flushSync: ReactDOM2.flushSync
|
|
@@ -791,8 +804,8 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
791
804
|
// the server loader flow regardless of whether the client loader calls
|
|
792
805
|
// `serverLoader` or not, otherwise we'll have nothing to render.
|
|
793
806
|
match.hasComponent && !match.element;
|
|
794
|
-
|
|
795
|
-
|
|
807
|
+
_chunk7SIULPXIjs.invariant.call(void 0, window.__reactRouterRouteModules);
|
|
808
|
+
_chunkQPXIKN46js.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
|
|
796
809
|
let dataRoute = {
|
|
797
810
|
id: match.id,
|
|
798
811
|
element: match.element,
|
|
@@ -840,7 +853,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
840
853
|
return await callSingleFetch(singleFetch);
|
|
841
854
|
}
|
|
842
855
|
}) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => {
|
|
843
|
-
throw
|
|
856
|
+
throw _chunk7SIULPXIjs.noActionDefinedError.call(void 0, "action", match.id);
|
|
844
857
|
},
|
|
845
858
|
path: match.path,
|
|
846
859
|
shouldRevalidate: match.shouldRevalidate,
|
|
@@ -852,7 +865,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
852
865
|
hasClientAction: match.clientAction != null
|
|
853
866
|
};
|
|
854
867
|
if (typeof dataRoute.loader === "function") {
|
|
855
|
-
dataRoute.loader.hydrate =
|
|
868
|
+
dataRoute.loader.hydrate = _chunk7SIULPXIjs.shouldHydrateRouteLoader.call(void 0,
|
|
856
869
|
match.id,
|
|
857
870
|
match.clientLoader,
|
|
858
871
|
match.hasLoader,
|
|
@@ -862,7 +875,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
862
875
|
return dataRoute;
|
|
863
876
|
}
|
|
864
877
|
function callSingleFetch(singleFetch) {
|
|
865
|
-
|
|
878
|
+
_chunk7SIULPXIjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
|
|
866
879
|
return singleFetch();
|
|
867
880
|
}
|
|
868
881
|
function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
|
@@ -870,7 +883,7 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
|
|
870
883
|
let fn = type === "action" ? "serverAction()" : "serverLoader()";
|
|
871
884
|
let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
|
|
872
885
|
console.error(msg);
|
|
873
|
-
throw new (0,
|
|
886
|
+
throw new (0, _chunk7SIULPXIjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
|
|
874
887
|
}
|
|
875
888
|
}
|
|
876
889
|
var nextPaths = /* @__PURE__ */ new Set();
|
|
@@ -893,12 +906,12 @@ function getManifestUrl(paths) {
|
|
|
893
906
|
return url;
|
|
894
907
|
}
|
|
895
908
|
async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fetchImplementation, signal) {
|
|
896
|
-
paths =
|
|
909
|
+
paths = _chunk7SIULPXIjs.getPathsWithAncestors.call(void 0, paths);
|
|
897
910
|
let url = getManifestUrl(paths);
|
|
898
911
|
if (url == null) {
|
|
899
912
|
return;
|
|
900
913
|
}
|
|
901
|
-
if (url.toString().length >
|
|
914
|
+
if (url.toString().length > _chunk7SIULPXIjs.URL_LIMIT) {
|
|
902
915
|
nextPaths.clear();
|
|
903
916
|
return;
|
|
904
917
|
}
|
|
@@ -942,8 +955,8 @@ function isExternalLocation(location2) {
|
|
|
942
955
|
return newLocation.origin !== window.location.origin;
|
|
943
956
|
}
|
|
944
957
|
function normalizeRedirectLocation(location2) {
|
|
945
|
-
if (
|
|
946
|
-
let path =
|
|
958
|
+
if (_chunk7SIULPXIjs.PROTOCOL_RELATIVE_URL_REGEX.test(location2)) {
|
|
959
|
+
let path = _chunk7SIULPXIjs.resolvePath.call(void 0, location2);
|
|
947
960
|
return path.pathname + path.search + path.hash;
|
|
948
961
|
}
|
|
949
962
|
return location2;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.18.
|
|
2
|
+
* react-router v7.18.3
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
RSCRouterGlobalErrorBoundary,
|
|
14
14
|
getHydrationData,
|
|
15
15
|
populateRSCRouteModules
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-HT4INDD5.mjs";
|
|
17
17
|
import {
|
|
18
18
|
CRITICAL_CSS_DATA_ATTRIBUTE,
|
|
19
19
|
ErrorResponseImpl,
|
|
@@ -45,8 +45,9 @@ import {
|
|
|
45
45
|
shouldHydrateRouteLoader,
|
|
46
46
|
singleFetchUrl,
|
|
47
47
|
stripIndexParam,
|
|
48
|
-
useFogOFWarDiscovery
|
|
49
|
-
|
|
48
|
+
useFogOFWarDiscovery,
|
|
49
|
+
validateNavigationTarget
|
|
50
|
+
} from "./chunk-BV7QT456.mjs";
|
|
50
51
|
|
|
51
52
|
// lib/dom-export/dom-router-provider.tsx
|
|
52
53
|
import * as React from "react";
|
|
@@ -299,6 +300,12 @@ function createCallServer({
|
|
|
299
300
|
Promise.resolve(payloadPromise).then(async (payload) => {
|
|
300
301
|
if (payload.type === "redirect") {
|
|
301
302
|
let location2 = normalizeRedirectLocation(payload.location);
|
|
303
|
+
validateNavigationTarget(
|
|
304
|
+
payload.location,
|
|
305
|
+
location2,
|
|
306
|
+
new URL(window.location.href),
|
|
307
|
+
"allow-explicit"
|
|
308
|
+
);
|
|
302
309
|
if (payload.reload || isExternalLocation(location2)) {
|
|
303
310
|
if (hasInvalidProtocol(location2)) {
|
|
304
311
|
throw new Error("Invalid redirect location");
|
|
@@ -320,6 +327,12 @@ function createCallServer({
|
|
|
320
327
|
if (rerender && landedActionId < actionId && globalVar.__routerActionID <= actionId) {
|
|
321
328
|
if (rerender.type === "redirect") {
|
|
322
329
|
let location2 = normalizeRedirectLocation(rerender.location);
|
|
330
|
+
validateNavigationTarget(
|
|
331
|
+
rerender.location,
|
|
332
|
+
location2,
|
|
333
|
+
new URL(window.location.href),
|
|
334
|
+
"allow-explicit"
|
|
335
|
+
);
|
|
323
336
|
if (rerender.reload || isExternalLocation(location2)) {
|
|
324
337
|
if (hasInvalidProtocol(location2)) {
|
|
325
338
|
throw new Error("Invalid redirect location");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as ServerInstrumentation, H as HydrationState, e as StaticHandlerContext, c as RelativeRoutingType, a as Router$1, g as RouterState, R as RouterInit, t as FutureConfig$1, C as ClientInstrumentation, d as GetScrollRestorationKeyFunction, F as Fetcher, B as BlockerFunction, u as CreateStaticHandlerOptions$1, S as StaticHandler } from './instrumentation-
|
|
1
|
+
import { l as ServerInstrumentation, H as HydrationState, e as StaticHandlerContext, c as RelativeRoutingType, a as Router$1, g as RouterState, R as RouterInit, t as FutureConfig$1, C as ClientInstrumentation, d as GetScrollRestorationKeyFunction, F as Fetcher, B as BlockerFunction, u as CreateStaticHandlerOptions$1, S as StaticHandler } from './instrumentation-B7w3_Eo9.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { p as RouteManifest, aE as ServerRouteModule, t as MiddlewareEnabled, c as RouterContextProvider, u as AppLoadContext, s as LoaderFunctionArgs, a0 as ActionFunctionArgs, O as RouteModules, n as DataRouteObject, a as ClientLoaderFunction, o as RouteBranch, aF as TrackedPromise, f as History, T as To, L as Location, i as Action, ac as RouteMatch, Y as InitialEntry, _ as NonIndexRouteObject, a7 as LazyRouteFunction, Z as IndexRouteObject, P as Params, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, e as RouteObject, U as UIMatch, q as HTMLFormMethod, F as FormEncType, av as PageLinkDescriptor, Q as SerializeFrom } from './data-CjO11-hU.js';
|
|
4
4
|
|
|
@@ -197,6 +197,7 @@ interface NavigateOptions {
|
|
|
197
197
|
*/
|
|
198
198
|
interface Navigator {
|
|
199
199
|
createHref: History["createHref"];
|
|
200
|
+
createURL?: History["createURL"];
|
|
200
201
|
encodeLocation?: History["encodeLocation"];
|
|
201
202
|
go: History["go"];
|
|
202
203
|
push(to: To, state?: any, opts?: NavigateOptions): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as ServerInstrumentation, H as HydrationState, h as StaticHandlerContext, f as RelativeRoutingType, g as GetScrollRestorationKeyFunction, R as RouterInit, ah as FutureConfig$1, C as ClientInstrumentation, N as NavigateOptions, F as Fetcher, c as Router, B as BlockerFunction, ai as CreateStaticHandlerOptions$1, S as StaticHandler } from './context-
|
|
1
|
+
import { o as ServerInstrumentation, H as HydrationState, h as StaticHandlerContext, f as RelativeRoutingType, g as GetScrollRestorationKeyFunction, R as RouterInit, ah as FutureConfig$1, C as ClientInstrumentation, N as NavigateOptions, F as Fetcher, c as Router, B as BlockerFunction, ai as CreateStaticHandlerOptions$1, S as StaticHandler } from './context-nqAapj74.mjs';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { J as RouteManifest, aF as ServerRouteModule, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, o as LoaderFunctionArgs, a3 as ActionFunctionArgs, Z as RouteModules, E as DataRouteObject, a as ClientLoaderFunction, I as RouteBranch, m as HTMLFormMethod, n as FormEncType, aw as PageLinkDescriptor, T as To, s as History, z as DataStrategyFunction, B as PatchRoutesOnNavigationFunction, r as RouteObject, _ as SerializeFrom, L as Location } from './data-DEjBmEfD.mjs';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Q as MemoryRouter, T as Navigate, U as Outlet, V as Route, W as Router, X as RouterProvider, Y as Routes, A as UNSAFE_AwaitContextProvider, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps } from './context-
|
|
2
|
-
export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-
|
|
1
|
+
export { Q as MemoryRouter, T as Navigate, U as Outlet, V as Route, W as Router, X as RouterProvider, Y as Routes, A as UNSAFE_AwaitContextProvider, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps } from './context-nqAapj74.mjs';
|
|
2
|
+
export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-K63fpMH4.mjs';
|
|
3
3
|
import './data-DEjBmEfD.mjs';
|
|
4
4
|
import 'react';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-
|
|
2
|
-
import './instrumentation-
|
|
1
|
+
export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-BjY-eKuf.js';
|
|
2
|
+
import './instrumentation-B7w3_Eo9.js';
|
|
3
3
|
import './data-CjO11-hU.js';
|
|
4
4
|
import 'react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
|
|
2
|
-
* react-router v7.18.
|
|
2
|
+
* react-router v7.18.3
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _chunkYRTY65LJjs = require('./chunk-YRTY65LJ.js');
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
@@ -34,7 +34,7 @@ var _chunk7XGYIT3Mjs = require('./chunk-7XGYIT3M.js');
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var _chunk7SIULPXIjs = require('./chunk-7SIULPXI.js');
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
@@ -58,4 +58,4 @@ var _chunkHHGH3NKSjs = require('./chunk-HHGH3NKS.js');
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
exports.BrowserRouter =
|
|
61
|
+
exports.BrowserRouter = _chunkYRTY65LJjs.BrowserRouter; exports.Form = _chunkYRTY65LJjs.Form; exports.HashRouter = _chunkYRTY65LJjs.HashRouter; exports.Link = _chunkYRTY65LJjs.Link; exports.Links = _chunk7SIULPXIjs.Links; exports.MemoryRouter = _chunk7SIULPXIjs.MemoryRouter; exports.Meta = _chunk7SIULPXIjs.Meta; exports.NavLink = _chunkYRTY65LJjs.NavLink; exports.Navigate = _chunk7SIULPXIjs.Navigate; exports.Outlet = _chunk7SIULPXIjs.Outlet; exports.Route = _chunk7SIULPXIjs.Route; exports.Router = _chunk7SIULPXIjs.Router; exports.RouterProvider = _chunk7SIULPXIjs.RouterProvider; exports.Routes = _chunk7SIULPXIjs.Routes; exports.ScrollRestoration = _chunkYRTY65LJjs.ScrollRestoration; exports.StaticRouter = _chunkYRTY65LJjs.StaticRouter; exports.StaticRouterProvider = _chunkYRTY65LJjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunk7SIULPXIjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunk7SIULPXIjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunk7SIULPXIjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunk7SIULPXIjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkYRTY65LJjs.HistoryRouter;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.18.
|
|
2
|
+
* react-router v7.18.3
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
WithComponentProps,
|
|
33
33
|
WithErrorBoundaryProps,
|
|
34
34
|
WithHydrateFallbackProps
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-BV7QT456.mjs";
|
|
36
36
|
export {
|
|
37
37
|
BrowserRouter,
|
|
38
38
|
Form,
|
|
@@ -1243,6 +1243,14 @@ interface Router {
|
|
|
1243
1243
|
* @param location
|
|
1244
1244
|
*/
|
|
1245
1245
|
createHref(location: Location | URL): string;
|
|
1246
|
+
/**
|
|
1247
|
+
* @private
|
|
1248
|
+
* PRIVATE - DO NOT USE
|
|
1249
|
+
*
|
|
1250
|
+
* Utility function to create a URL for the given location
|
|
1251
|
+
* @param location
|
|
1252
|
+
*/
|
|
1253
|
+
createURL?(to: To): URL;
|
|
1246
1254
|
/**
|
|
1247
1255
|
* @private
|
|
1248
1256
|
* PRIVATE - DO NOT USE
|
|
@@ -1243,6 +1243,14 @@ interface Router {
|
|
|
1243
1243
|
* @param location
|
|
1244
1244
|
*/
|
|
1245
1245
|
createHref(location: Location | URL): string;
|
|
1246
|
+
/**
|
|
1247
|
+
* @private
|
|
1248
|
+
* PRIVATE - DO NOT USE
|
|
1249
|
+
*
|
|
1250
|
+
* Utility function to create a URL for the given location
|
|
1251
|
+
* @param location
|
|
1252
|
+
*/
|
|
1253
|
+
createURL?(to: To): URL;
|
|
1246
1254
|
/**
|
|
1247
1255
|
* @private
|
|
1248
1256
|
* PRIVATE - DO NOT USE
|
|
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
|
|
|
27
27
|
var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* react-router v7.18.
|
|
30
|
+
* react-router v7.18.3
|
|
31
31
|
*
|
|
32
32
|
* Copyright (c) Remix Software Inc.
|
|
33
33
|
*
|
|
@@ -664,13 +664,16 @@ function matchPathImpl(pattern, pathname, matcher, compiledParams) {
|
|
|
664
664
|
let match = pathname.match(matcher);
|
|
665
665
|
if (!match) return null;
|
|
666
666
|
let matchedPathname = match[0];
|
|
667
|
-
let pathnameBase = matchedPathname
|
|
667
|
+
let pathnameBase = removeTrailingSlash(matchedPathname, 1);
|
|
668
668
|
let captureGroups = match.slice(1);
|
|
669
669
|
let params = compiledParams.reduce(
|
|
670
670
|
(memo, { paramName, isOptional }, index) => {
|
|
671
671
|
if (paramName === "*") {
|
|
672
672
|
let splatValue = captureGroups[index] || "";
|
|
673
|
-
pathnameBase =
|
|
673
|
+
pathnameBase = removeTrailingSlash(
|
|
674
|
+
matchedPathname.slice(0, matchedPathname.length - splatValue.length),
|
|
675
|
+
1
|
|
676
|
+
);
|
|
674
677
|
}
|
|
675
678
|
const value = captureGroups[index];
|
|
676
679
|
if (isOptional && !value) {
|
|
@@ -759,7 +762,7 @@ function resolvePath(to, fromPathname = "/") {
|
|
|
759
762
|
let pathname;
|
|
760
763
|
if (toPathname) {
|
|
761
764
|
toPathname = removeDoubleSlashes(toPathname);
|
|
762
|
-
if (toPathname.startsWith("/")) {
|
|
765
|
+
if (toPathname.startsWith("/") || toPathname.startsWith("\\")) {
|
|
763
766
|
pathname = resolvePathname(toPathname.substring(1), "/");
|
|
764
767
|
} else {
|
|
765
768
|
pathname = resolvePathname(toPathname, fromPathname);
|
|
@@ -847,7 +850,13 @@ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = fal
|
|
|
847
850
|
}
|
|
848
851
|
var removeDoubleSlashes = (path) => path.replace(/[\\/]{2,}/g, "/");
|
|
849
852
|
var joinPaths = (paths) => removeDoubleSlashes(paths.join("/"));
|
|
850
|
-
|
|
853
|
+
function removeTrailingSlash(path, minLength = 0) {
|
|
854
|
+
let end = path.length;
|
|
855
|
+
while (end > minLength && path.charCodeAt(end - 1) === 47) {
|
|
856
|
+
end--;
|
|
857
|
+
}
|
|
858
|
+
return end === path.length ? path : path.slice(0, end);
|
|
859
|
+
}
|
|
851
860
|
var normalizePathname = (pathname) => removeTrailingSlash(pathname).replace(/^\/*/, "/");
|
|
852
861
|
var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
|
|
853
862
|
var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
|
|
@@ -2561,18 +2570,25 @@ function getPathsWithAncestors(paths) {
|
|
|
2561
2570
|
function throwIfPotentialCSRFAttack(request, allowedActionOrigins) {
|
|
2562
2571
|
let originHeader = request.headers.get("origin");
|
|
2563
2572
|
let originDomain = null;
|
|
2573
|
+
let originUrl = null;
|
|
2564
2574
|
try {
|
|
2565
|
-
|
|
2575
|
+
if (typeof originHeader === "string" && originHeader !== "null") {
|
|
2576
|
+
originUrl = new URL(originHeader);
|
|
2577
|
+
originDomain = originUrl.host;
|
|
2578
|
+
} else {
|
|
2579
|
+
originDomain = originHeader;
|
|
2580
|
+
}
|
|
2566
2581
|
} catch {
|
|
2567
2582
|
throw new Error(
|
|
2568
2583
|
`\`origin\` header is not a valid URL. Aborting the action.`
|
|
2569
2584
|
);
|
|
2570
2585
|
}
|
|
2571
|
-
let
|
|
2572
|
-
|
|
2586
|
+
let requestUrl = new URL(request.url);
|
|
2587
|
+
let originMatchesRequest = originUrl ? originUrl.origin === requestUrl.origin : originDomain === requestUrl.host;
|
|
2588
|
+
if (originDomain && !originMatchesRequest) {
|
|
2573
2589
|
if (!isAllowedOrigin(originDomain, allowedActionOrigins)) {
|
|
2574
2590
|
throw new Error(
|
|
2575
|
-
"The `request.url`
|
|
2591
|
+
"The `request.url` origin does not match `origin` header from a forwarded action request. Aborting the action."
|
|
2576
2592
|
);
|
|
2577
2593
|
}
|
|
2578
2594
|
}
|
|
@@ -6,7 +6,7 @@ export { BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta, NavLi
|
|
|
6
6
|
import { serialize, parse } from 'cookie';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* react-router v7.18.
|
|
9
|
+
* react-router v7.18.3
|
|
10
10
|
*
|
|
11
11
|
* Copyright (c) Remix Software Inc.
|
|
12
12
|
*
|
|
@@ -643,13 +643,16 @@ function matchPathImpl(pattern, pathname, matcher, compiledParams) {
|
|
|
643
643
|
let match = pathname.match(matcher);
|
|
644
644
|
if (!match) return null;
|
|
645
645
|
let matchedPathname = match[0];
|
|
646
|
-
let pathnameBase = matchedPathname
|
|
646
|
+
let pathnameBase = removeTrailingSlash(matchedPathname, 1);
|
|
647
647
|
let captureGroups = match.slice(1);
|
|
648
648
|
let params = compiledParams.reduce(
|
|
649
649
|
(memo, { paramName, isOptional }, index) => {
|
|
650
650
|
if (paramName === "*") {
|
|
651
651
|
let splatValue = captureGroups[index] || "";
|
|
652
|
-
pathnameBase =
|
|
652
|
+
pathnameBase = removeTrailingSlash(
|
|
653
|
+
matchedPathname.slice(0, matchedPathname.length - splatValue.length),
|
|
654
|
+
1
|
|
655
|
+
);
|
|
653
656
|
}
|
|
654
657
|
const value = captureGroups[index];
|
|
655
658
|
if (isOptional && !value) {
|
|
@@ -738,7 +741,7 @@ function resolvePath(to, fromPathname = "/") {
|
|
|
738
741
|
let pathname;
|
|
739
742
|
if (toPathname) {
|
|
740
743
|
toPathname = removeDoubleSlashes(toPathname);
|
|
741
|
-
if (toPathname.startsWith("/")) {
|
|
744
|
+
if (toPathname.startsWith("/") || toPathname.startsWith("\\")) {
|
|
742
745
|
pathname = resolvePathname(toPathname.substring(1), "/");
|
|
743
746
|
} else {
|
|
744
747
|
pathname = resolvePathname(toPathname, fromPathname);
|
|
@@ -826,7 +829,13 @@ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = fal
|
|
|
826
829
|
}
|
|
827
830
|
var removeDoubleSlashes = (path) => path.replace(/[\\/]{2,}/g, "/");
|
|
828
831
|
var joinPaths = (paths) => removeDoubleSlashes(paths.join("/"));
|
|
829
|
-
|
|
832
|
+
function removeTrailingSlash(path, minLength = 0) {
|
|
833
|
+
let end = path.length;
|
|
834
|
+
while (end > minLength && path.charCodeAt(end - 1) === 47) {
|
|
835
|
+
end--;
|
|
836
|
+
}
|
|
837
|
+
return end === path.length ? path : path.slice(0, end);
|
|
838
|
+
}
|
|
830
839
|
var normalizePathname = (pathname) => removeTrailingSlash(pathname).replace(/^\/*/, "/");
|
|
831
840
|
var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
|
|
832
841
|
var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
|
|
@@ -2540,18 +2549,25 @@ function getPathsWithAncestors(paths) {
|
|
|
2540
2549
|
function throwIfPotentialCSRFAttack(request, allowedActionOrigins) {
|
|
2541
2550
|
let originHeader = request.headers.get("origin");
|
|
2542
2551
|
let originDomain = null;
|
|
2552
|
+
let originUrl = null;
|
|
2543
2553
|
try {
|
|
2544
|
-
|
|
2554
|
+
if (typeof originHeader === "string" && originHeader !== "null") {
|
|
2555
|
+
originUrl = new URL(originHeader);
|
|
2556
|
+
originDomain = originUrl.host;
|
|
2557
|
+
} else {
|
|
2558
|
+
originDomain = originHeader;
|
|
2559
|
+
}
|
|
2545
2560
|
} catch {
|
|
2546
2561
|
throw new Error(
|
|
2547
2562
|
`\`origin\` header is not a valid URL. Aborting the action.`
|
|
2548
2563
|
);
|
|
2549
2564
|
}
|
|
2550
|
-
let
|
|
2551
|
-
|
|
2565
|
+
let requestUrl = new URL(request.url);
|
|
2566
|
+
let originMatchesRequest = originUrl ? originUrl.origin === requestUrl.origin : originDomain === requestUrl.host;
|
|
2567
|
+
if (originDomain && !originMatchesRequest) {
|
|
2552
2568
|
if (!isAllowedOrigin(originDomain, allowedActionOrigins)) {
|
|
2553
2569
|
throw new Error(
|
|
2554
|
-
"The `request.url`
|
|
2570
|
+
"The `request.url` origin does not match `origin` header from a forwarded action request. Aborting the action."
|
|
2555
2571
|
);
|
|
2556
2572
|
}
|
|
2557
2573
|
}
|