We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0262296 commit 1508990Copy full SHA for 1508990
packages/cli-server-api/src/openURLMiddleware.ts
@@ -31,6 +31,19 @@ async function openURLMiddleware(
31
32
const {url} = req.body as {url: string};
33
34
+ try {
35
+ const parsedUrl = new URL(url);
36
+ if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {
37
+ res.writeHead(400);
38
+ res.end('Invalid URL protocol');
39
+ return;
40
+ }
41
+ } catch (error) {
42
43
+ res.end('Invalid URL format');
44
45
46
+
47
await open(url);
48
49
res.writeHead(200);
0 commit comments