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

Magnet link not working #59

Open
Umaroth opened this issue Jun 9, 2024 · 3 comments · May be fixed by #68
Open

Magnet link not working #59

Umaroth opened this issue Jun 9, 2024 · 3 comments · May be fixed by #68

Comments

@Umaroth
Copy link

Umaroth commented Jun 9, 2024

image

Links starts with "magnet://" yet still get error saying that link needs to start with "magnet://"

Full magnet link (works if pasted into browser):

magnet://?xt=urn:btih:600c0f4df16256c410ab85adcb2c4011e0394b61&dn=Star%20Wars%20IV%20Despecialized%20Edition%20v2.7%20AVCHD%20ISO&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.tiny-vps.com%3A6969%2Fannounce&tr=http%3A%2F%2Ftracker.gbitt.info%3A80%2Fannounce&tr=http%3A%2F%2Ftracker.renfei.net%3A8080%2Fannounce&tr=udp%3A%2F%2Ftracker-udp.gbitt.info%3A80%2Fannounce&tr=udp%3A%2F%2Fopen.free-tracker.ga%3A6969%2Fannounce&tr=udp%3A%2F%2Fnew-line.net%3A6969%2Fannounce&tr=udp%3A%2F%2Fmoonburrow.club%3A6969%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=https%3A%2F%2Ftracker.tamersunion.org%3A443%2Fannounce&tr=https%3A%2F%2Ftracker.renfei.net%3A443%2Fannounce&tr=https%3A%2F%2Ftracker.gbitt.info%3A443%2Fannounce&tr=udp%3A%2F%2Ftracker.0x7c0.com%3A6969%2Fannounce&tr=udp%3A%2F%2Foh.fuuuuuck.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.dump.cl%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.bittor.pw%3A1337%2Fannounce&tr=udp%3A%2F%2Fopentracker.io%3A6969%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce

@Umaroth
Copy link
Author

Umaroth commented Jun 9, 2024

I think I found the problem on line 42 of index.jsx which was updated 4 months ago in the Add google API check update.

New RegEx:
/^(\S+:\/\/)[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,16}(:[0-9]{1,5})?(\/.*)?$/

Old RegEx:
/(magnet:\?xt=urn:btih:[a-zA-Z0-9]*)|(^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,8}(:[0-9]{1,5})?(\/.*)?$)/

This link passes the Old Regex: magnet:?xt=urn:btih:600c0f4df16256c410ab85adcb2c4011e0394b61&dn=Star%20Wars%20IV%20Despecialized%20Edition%20v2.7%20AVCHD%20ISO&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.tiny-vps.com%3A6969%2Fannounce&tr=http%3A%2F%2Ftracker.gbitt.info%3A80%2Fannounce&tr=http%3A%2F%2Ftracker.renfei.net%3A8080%2Fannounce&tr=udp%3A%2F%2Ftracker-udp.gbitt.info%3A80%2Fannounce&tr=udp%3A%2F%2Fopen.free-tracker.ga%3A6969%2Fannounce&tr=udp%3A%2F%2Fnew-line.net%3A6969%2Fannounce&tr=udp%3A%2F%2Fmoonburrow.club%3A6969%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=https%3A%2F%2Ftracker.tamersunion.org%3A443%2Fannounce&tr=https%3A%2F%2Ftracker.renfei.net%3A443%2Fannounce&tr=https%3A%2F%2Ftracker.gbitt.info%3A443%2Fannounce&tr=udp%3A%2F%2Ftracker.0x7c0.com%3A6969%2Fannounce&tr=udp%3A%2F%2Foh.fuuuuuck.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.dump.cl%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.bittor.pw%3A1337%2Fannounce&tr=udp%3A%2F%2Fopentracker.io%3A6969%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce

But I can't find ANY way to get ANY magnet link to pass the new RegEx.

Notably, even with the Old RegEx, magnet links do NOT pass if formatted as magnet:// and need the slashes removed so the warning from my original image should also be updated to read Please make sure your link starts with 'http://' or 'https://' or 'magnet:' (or you could update the RegEx to support magnet://)

@pedropinto0
Copy link

I'm having the same problem, shame that no solution has been found

@brian6932
Copy link
Contributor

brian6932 commented Oct 16, 2024

I'm getting a similar issue with every magnet link (e.g. magnet:?xt=urn:btih:737e24b5ab9e409cfc0ed80d93cba5b320396572), this issue's more of a documentation mistake, I'll open a new issue regarding this. I submitted a PR which did magnet link validation in #48, but they never chose to merge it. It would technically also fail, as the above issue doesn't really follow the magnet link spec (there's no // following the protocol in magnet links), and added a simple prefix check instead.

I think I found the problem on line 42 of index.jsx which was updated 4 months ago in the Add google API check update.

I tested their current regexes in /pages/api/create.js, and they do at least pass a standard magnet link prefix check for me. /pages/index.jsx isn't the problem, that's the frontend, the backend's in a different dir /pages/api, you can test this yourself by posting to the api, and/or reading through the requests on page, then seeing that you hit:
https://github.com/NayamAmarshe/MagLit/blob/e780c2010bd4d1e521b5e62b25c5c8b183b5a687/pages/api/create.js#L145

brian6932 added a commit to brian6932/MagLit that referenced this issue Oct 16, 2024
@brian6932 brian6932 linked a pull request Oct 16, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants