From 7fc15b6d42b9549946436247668a80620bed0b61 Mon Sep 17 00:00:00 2001 From: Zhuo Zhang Date: Wed, 26 Jul 2023 11:59:25 +0800 Subject: [PATCH] url: fix `isURL` detection by checking `path` Fixes: https://github.com/nodejs/node/issues/48921 PR-URL: https://github.com/nodejs/node/pull/48928 Backport-PR-URL: https://github.com/nodejs/node/pull/50105 Fixes: https://github.com/getsentry/sentry-javascript/issues/8552 Fixes: https://github.com/request/request/issues/3458 Reviewed-By: Yagiz Nizipli Reviewed-By: Luigi Pinca Reviewed-By: Matthew Aitken Reviewed-By: Debadree Chatterjee --- test/parallel/test-url-is-url.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/parallel/test-url-is-url.js b/test/parallel/test-url-is-url.js index 0b42bb3b2f2d4a..6bb8a1595df2a0 100644 --- a/test/parallel/test-url-is-url.js +++ b/test/parallel/test-url-is-url.js @@ -9,3 +9,8 @@ const { isURL } = require('internal/url'); assert.strictEqual(isURL(new URL('https://www.nodejs.org')), true); assert.strictEqual(isURL(parse('https://www.nodejs.org')), false); +assert.strictEqual(isURL({ + href: 'https://www.nodejs.org', + protocol: 'https:', + path: '/', +}), false);