diff --git a/contributors.yml b/contributors.yml index 0b39965f86..42d874c525 100644 --- a/contributors.yml +++ b/contributors.yml @@ -89,6 +89,7 @@ - latin-1 - lequangdongg - liuhanqu +- lkwr - lopezac - lordofthecactus - loun4 diff --git a/packages/router/__tests__/router-test.ts b/packages/router/__tests__/router-test.ts index fa18d8c0b7..a91a441260 100644 --- a/packages/router/__tests__/router-test.ts +++ b/packages/router/__tests__/router-test.ts @@ -10673,6 +10673,8 @@ describe("a router", () => { "https://remix.run/blog", "//remix.run/blog", "app://whatever", + "mailto:hello@remix.run", + "web+remix:whatever", ]; for (let url of urls) { diff --git a/packages/router/router.ts b/packages/router/router.ts index bf8b979da9..81f215ff7e 100644 --- a/packages/router/router.ts +++ b/packages/router/router.ts @@ -2683,8 +2683,7 @@ async function callLoaderOrAction( "Redirects returned/thrown from loaders/actions must have a Location header" ); - let isAbsolute = - /^[a-z+]+:\/\//i.test(location) || location.startsWith("//"); + let isAbsolute = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(location); // Support relative routing in internal redirects if (!isAbsolute) {