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

TypeError: Cannot read property 'toLowerCase' of undefined #173

Closed
rien333 opened this issue Jul 11, 2021 · 4 comments · Fixed by #175
Closed

TypeError: Cannot read property 'toLowerCase' of undefined #173

rien333 opened this issue Jul 11, 2021 · 4 comments · Fixed by #175
Assignees

Comments

@rien333
Copy link

rien333 commented Jul 11, 2021

What version of this package are you using?

$ webtorrent --version
3.3.1 (1.2.0)

What operating system, Node.js, and npm version?

  1. OS: Arch Linux (kernel version 5.12.15)
  2. node: v16.4.2
  3. npm: 7.17.0

(I installed webtorrent-cli via the AUR)

What happened?

Everytime I open a magnet link, I get the following error (right after webtorrent is done fetching metada from peers):

$ webtorrent 'magnet:?xt=urn:btih:2bd9d334e8d1e5bd7768755173222db5c6dea13b&dn=archlinux-2021.07.01-x86_64.iso'


UNEXPECTED ERROR: If this is a bug in WebTorrent, report it!
OPEN AN ISSUE: https://github.com/webtorrent/webtorrent-cli/issues

DEBUG INFO: webtorrent-cli 3.3.1, webtorrent 1.2.0, node v16.4.2, linux x64, exit 1
/usr/lib/webtorrent-cli/bin/cmd.js:468
          [].concat(argv.chromecast).find(name => player.name.toLowerCase().includes(name.toLowerCase()))
^

TypeError: Cannot read property 'toLowerCase' of undefined
    at /usr/lib/webtorrent-cli/bin/cmd.js:468:91
    at Array.find (<anonymous>)
    at EventEmitter.<anonymous> (/usr/lib/webtorrent-cli/bin/cmd.js:468:38)
    at EventEmitter.emit (node:events:394:28)
    at emit (/usr/lib/webtorrent-cli/node_modules/chromecasts/index.js:238:10)
    at onanswer (/usr/lib/webtorrent-cli/node_modules/chromecasts/index.js:256:9)
    at Array.forEach (<anonymous>)
    at EventEmitter.<anonymous> (/usr/lib/webtorrent-cli/node_modules/chromecasts/index.js:276:26)
    at EventEmitter.emit (node:events:394:28)
    at Socket.<anonymous> (/usr/lib/webtorrent-cli/node_modules/multicast-dns/index.js:49:43)

I'm pretty sure the bug came with a recent update of this package.

What did you expect to happen?

No error.

Are you willing to submit a pull request to fix this bug?

Not that good with nodejs

@alxhotel alxhotel added the bug label Jul 11, 2021
@DiegoRBaquero DiegoRBaquero self-assigned this Jul 12, 2021
@OsmanAltun
Copy link
Contributor

I can't seem to reproduce this (it works for me on Arch), however if (argv.chromecast !== false) { does not have the intended behavior. It needs to change to if (argv.chromecast) { and that might be the fix.

@champramentio
Copy link

i can confirm the same issue. It's cmd.js at line 468

I made a quick fix, could you please check it?
.find(name => name ? player.name.toLowerCase().includes(name.toLowerCase()) : "")

@webtorrent-bot
Copy link

🎉 This issue has been resolved in version 3.3.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@rien333
Copy link
Author

rien333 commented Jul 15, 2021

Thanks for the fix, lovely program :)

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

Successfully merging a pull request may close this issue.

6 participants