GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — url: suppress warnings from url.format/url.resolve inside node_modules · nodejs/node@deead95

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • url.js
  • test
    • fixtures/node_modules
      • url-deprecations.js
    • parallel
      • test-url-parse-deprecation.js
      • test-url-parse-invalid-input.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/url.js‎

Copy file name to clipboardExpand all lines: lib/url.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ const {
132132
let urlParseWarned = false;
133133

134134
function urlParse(url, parseQueryString, slashesDenoteHost) {
135-
if (!urlParseWarned && !isInsideNodeModules(2)) {
135+
if (!urlParseWarned && !isInsideNodeModules(4)) {
136136
urlParseWarned = true;
137137
process.emitWarning(
138138
'`url.parse()` behavior is not standardized and prone to ' +
Collapse file

‎test/fixtures/node_modules/url-deprecations.js‎

Copy file name to clipboardExpand all lines: test/fixtures/node_modules/url-deprecations.js
+5Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎test/parallel/test-url-parse-deprecation.js‎

Copy file name to clipboard
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
const fixtures = require('../common/fixtures');
5+
6+
const assert = require('assert');
7+
const url = require('url');
8+
9+
const fixturePath = fixtures.path('node_modules', 'url-deprecations.js');
10+
11+
// Application deprecation for url.parse()
12+
url.parse('foo');
13+
common.expectWarning('DeprecationWarning',
14+
[/`url\.parse\(\)` behavior is not standardized/, 'DEP0169']);
15+
16+
// No warnings from inside node_modules
17+
common.spawnPromisified(process.execPath, [fixturePath]).then(
18+
common.mustCall(({ code, signal, stderr }) => {
19+
assert.strictEqual(code, 0);
20+
assert.strictEqual(signal, null);
21+
assert.doesNotMatch(stderr, /\[DEP0169\]/);
22+
})
23+
);
Collapse file

‎test/parallel/test-url-parse-invalid-input.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-url-parse-invalid-input.js
-7Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,6 @@ if (common.hasIntl) {
8787
}));
8888
});
8989

90-
// Warning should only happen once per process.
91-
common.expectWarning({
92-
DeprecationWarning: {
93-
// eslint-disable-next-line @stylistic/js/max-len
94-
DEP0169: '`url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.',
95-
},
96-
});
9790
badURLs.forEach((badURL) => {
9891
assert.throws(() => url.parse(badURL), {
9992
code: 'ERR_INVALID_ARG_VALUE',

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.