4 ms·
Tell HN: Android Patterns.WEB_URL does not match IPv6
I found a bug in an open source app I'm using, regarding http URLs with an ipv6 address, and before opening an issue I checked why this happened.
To my surprise the code was very simple and relied on the android.util.Patterns.WEB_URL pattern, which according to the docs should match all RFC 3987 IRIs.
But I took a look at the Patterns.java source code, and saw that it does not match ipv6 addresses.
https://developer.android.com/reference/android/util/Patterns#WEB_URL
https://android.googlesource.com/platform/frameworks/base/+/refs/heads/main/core/java/android/util/Patterns.java#376
- xmprt 3y agoThis might have been fixed super quickly but seems like the WEB_URL docs say it matches "most part of RFC 3987 Internationalized URLs" and not all.
- SushiHippie 3y agoYou are correct I somehow got it mixed up with the Pattern one above in the docs, which uses the word "all". https://developer.android.com/reference/android/util/Patterns#TOP_LEVEL_DOMAIN https://developer.android.com/reference/android/util/Pattern...