killemov / Shift

A minimalistic approach to maximum control of your Transmission. (Web UI)
https://forum.transmissionbt.com/viewtopic.php?f=8&t=12555
260 stars 20 forks source link

Magnet links with square brackets in the dn part don't work with registered magnet: URL handler #24

Closed fjkda closed 1 year ago

fjkda commented 1 year ago

Something like: http://localhost/transmission/web/?uri=magnet:?xt=urn:btih:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&dn=LinuxDistribution[abc]&tr=udp%3A%2F%2Fxyz.com%3A80%2Fannounce&tr=udp%3A%2F%2Fabc.com%3A6969%2Fannounce

https://github.com/killemov/Shift/blob/c56c5d647f8e95ae194a23af0dd9aa2656abe62d/shift.js#L254

Suggest this that also matches parenthesis: const torrentRegExp = /(\b(https?|ftp|magnet):\/?\/?[\-A-Z0-9()[\]+&@#\/%?=~_|!:,.;]*[\-A-Z0-9()[\]+&@#\/%=~_|])/ig;

killemov commented 1 year ago

AFAIK [ and ] must also be encoded. See Reserved characters in https://www.urldecoder.org/ .

fjkda commented 1 year ago

Ah, maybe it's on the site generating the links then