[BUG] Http trackers in magnets trigger the standard web regex and breaks link recognition
LivingWithHippos opened this issue · 0 comments
LivingWithHippos commented
how to reproduce:
- find a magnet link with an http tracker like
...&tr=http://tracker.trackerfix.com...
- share it with unchained
- it will get recognized as a normal hoster link and be sent to the hosters api instead of the magnets api breaking the unlock
the breaking code is
val urlPattern =
"https?://(-\\.)?([\\w]+\\.)+([\\w]{2,})+(#([\\w\\-]+))?(/[\\w\\-\\.,?^=%&:/~+#]*)?"
val simpleWebRegex = Regex(urlPattern)
fun String.isSimpleWebUrl(): Boolean = simpleWebRegex.containsMatchIn(this)
since containsMatchIn
just checks if there's a match anywhere in the string.
Move isSimpleWebUrl
as last check when checking a link