webtorrent / webtorrent-cli

WebTorrent, the streaming torrent client. For the command line.
https://webtorrent.io
MIT License
1.18k stars 135 forks source link

How to deal with ":" taken from "Name:" in the metadata used for naming folder? #266

Closed stl3 closed 1 year ago

stl3 commented 1 year ago

What version of this package are you using? DEBUG INFO: webtorrent-cli 4.1.0, webtorrent 1.9.6, What operating system, Node.js, and npm version? Win10 21H2 19044.2364, node v18.1.0, npm 8.9.0 What happened? I was trying to download a torrent which decided it wanted to name the folder with an illegal character in the name like "Blah: Oogie Boogie". I assume webtorrent-cli is parsing the name of the torrent in its metadata as using something like transmission-show will show something like Name: Blahblah boOoo: Snoo Bee Booo (1994) [1080p] What did you expect to happen? In windows, using ":" character is not allowed in the folder name. If webtorrent-cli is getting the name from the metadata in .torrent/magnet/etc it should properly parse out illegal characters so it doesn't conflict when it creates a folder based on the name. In another bittorrent client, I have downloaded the .torrent and also the magnet link and it looks like they've converted ":" to "" for both the folder it creates and any files that may inherit illegal chars. Are you willing to submit a pull request to fix this bug? I'm not knowledgeable enough to make the changes but I think adding: `torrent.name = torrent.name.replace(/:/g, ""); above ``line(chalk{green ${seeding ? 'Seeding' : 'Downloading'}:} {bold ${torrent.name}})`` and ``let fileName = torrent.files[index].name; fileName = fileName.replace(/:/g, "_"); let encodedFileName = encodeURIComponent(fileName); href +=/${index}/${encodedFileName}; `` in place of: ``` href +=/${index}/${encodeURIComponent(torrent.files[index].name)}` ` Helped me resolve the problem with the filename, but not the folder names as I still get this error: Error: ENOENT: no such file or directory, mkdir 'H:\Programming\watch\Blahblah boOoo: Snoo Bee Booo (1994) [1080p]'``

Where do I need to .replace the text that it's using for folder names?

github-actions[bot] commented 1 year ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?