Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upUrl-encoded magnet links don't work #1747
Comments
This comment has been minimized.
This comment has been minimized.
|
I've never seen a magnet uri shared in this format. What is the use case here? |
This comment has been minimized.
This comment has been minimized.
|
Extracting links from a web page, where the magnet links are in the query parameters part of URLs. For example: Torrent list
And to be a bit more specific with the use case, as I said I used webtorrent-desktop, where I tried to paste such an encoded link and got an error that it is invalid. |
This comment has been minimized.
This comment has been minimized.
|
Just decode the query parameter. const url = new URL('https://example.com/pretty-print-magnet?link=magnet%3A%3Fxt%3Durn%3Abtih')
url.searchParams.get('link') // magnet:?xt=urn:btih |
This comment has been minimized.
This comment has been minimized.
|
A non-technical user will have trouble doing that. As I mentioned the link is pasted into webtorrent-desktop, which passes it as-is to webtorrent. So the question is, should decoding be introduced in webtorrent-desktop or webtorrent. Making webtorrent-desktop's enduser do the decoding himself before pasting feels wrong. |
This comment has been minimized.
This comment has been minimized.
|
Sorry I didn't read the issue thoroughly. How does the end user receive the link? is it not possible for some code to decode before displaying to the user? |
This comment has been minimized.
This comment has been minimized.
|
The end user copies it from the web page in his browser. There is no control over the web page's source. It is of course possible to write some kind of a tailored browser plug-in, but that would require plugins for Chrome and Firefox, and will not solve the problem for browsers without plugin support like IE. |
This comment has been minimized.
This comment has been minimized.
|
@stopmachine Thanks for your responses, but I'm still confused a bit. What do the example links you posted actually link to? WebTorrent would assume this is a link to a .torrent file and attempt to download it. Or are you saying that the user would slice off the part after Also, what do other torrent clients do in this case?
|
This comment has been minimized.
This comment has been minimized.
Exactly. I've tested Transmission, it fails too when pasting a url-encoded link (it doesn't support pasting in the main window like WebTorrent Desktop does, you have to select File -> Open URL from the menu first). But I like WebTorrent Desktop because it's better, not because it's on-par :) |
What version of WebTorrent?
0.107.16
What operating system and Node.js version?
Ubuntu
What browser and version? (if using WebTorrent in the browser)
Using webtorrent-desktop, but I traced the issue to webtorrent
What did you expect to happen?
Adding a url-encoded magnet link will be decoded and will successfully start downloading
What actually happened?
Passing a url-encoded magnet link ("magnet%3A%3Fxt%3Durn%3Abtih...") fails