File tree Expand file tree Collapse file tree 1 file changed +1
-16
lines changed
packages/next/src/server/app-render Expand file tree Collapse file tree 1 file changed +1
-16
lines changed Original file line number Diff line number Diff line change 1
1
const DUMMY_ORIGIN = 'http://n'
2
2
const INVALID_URL_MESSAGE = 'Invalid request URL'
3
3
4
- // URL.canParse is supported on Node 19 and 20.
5
- // Node 18 backport is pending.
6
- // Reference: https://github.com/nodejs/node/pull/48345
7
- const supportsCanParse = URL . hasOwnProperty ( 'canParse' )
8
-
9
4
export function validateURL ( url : string | undefined ) : string {
10
- if ( url == null ) {
5
+ if ( ! url ) {
11
6
throw new Error ( INVALID_URL_MESSAGE )
12
7
}
13
-
14
- if ( supportsCanParse ) {
15
- // @ts -ignore
16
- if ( ! URL . canParse ( url , DUMMY_ORIGIN ) ) {
17
- throw new Error ( INVALID_URL_MESSAGE )
18
- }
19
-
20
- return url
21
- }
22
-
23
8
try {
24
9
const parsed = new URL ( url , DUMMY_ORIGIN )
25
10
// Avoid origin change by extra slashes in pathname
You can’t perform that action at this time.
0 commit comments