Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node 20.11.1 emits deprecation warning DEP0170 #295

Open
gromnitsky opened this issue Mar 1, 2024 · 1 comment
Open

Node 20.11.1 emits deprecation warning DEP0170 #295

gromnitsky opened this issue Mar 1, 2024 · 1 comment

Comments

@gromnitsky
Copy link

I stumbled upon this while parsing a mastodon feed (I saved the example here). A minimal variant of an unfourtunate feed boils down to

<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <link rel="self" href="http://example.com" />
  <entry>
    <link href="tag:mefi.social,2024-01-26:objectId=20368395" />
  </entry>
</feed>

If I parse such xml with feedparser 2.2.1

import FeedParser from 'feedparser'
import {pipeline} from 'stream/promises'
import {createReadStream} from 'fs'

let feedparser = new FeedParser()
await pipeline(createReadStream(process.argv[2]), feedparser)

I get

$ node --throw-deprecation DEP0170.js lol.xml
node:internal/process/warning:185
        throw warning;
        ^

DeprecationWarning: The URL tag:mefi.social,2024-01-26:objectId=20368395 is invalid. Future versions of Node.js will throw an error.
    at getHostname (node:url:516:17)
    at Url.parse (node:url:384:14)
    at urlParse (node:url:141:13)
    at Url.resolve (node:url:722:29)
    at Object.urlResolve [as resolve] (node:url:718:40)
    at /mnt/hdd3/Downloads/DEP0170/node_modules/feedparser/lib/utils.js:148:46
    at Array.forEach (<anonymous>)
    at /mnt/hdd3/Downloads/DEP0170/node_modules/feedparser/lib/utils.js:145:19
    at Array.forEach (<anonymous>)
    at resolveLevel (/mnt/hdd3/Downloads/DEP0170/node_modules/feedparser/lib/utils.js:120:9) {
  code: 'DEP0170'
}
@danmactough
Copy link
Owner

Thanks for the report @gromnitsky

Looks like the solution in npm/npm-package-arg#141 should work for us, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants