mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 19:57:27 -08:00
Fix slight problem in heuristic for detecting URIs: accept a.singleletterdomainelement.com
git-svn-id: https://zxing.googlecode.com/svn/trunk@2108 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
ccf169425f
commit
01c274cfd1
|
@ -37,7 +37,7 @@ public final class HttpHelper {
|
|||
|
||||
private static final Collection<String> REDIRECTOR_DOMAINS = new HashSet<String>(Arrays.asList(
|
||||
"amzn.to", "bit.ly", "bitly.com", "fb.me", "goo.gl", "is.gd", "j.mp", "lnkd.in", "ow.ly",
|
||||
"SCN.BY", "su.pr", "t.co", "tinyurl.com", "tr.im"
|
||||
"R.BEETAGG.COM", "r.beetagg.com", "SCN.BY", "su.pr", "t.co", "tinyurl.com", "tr.im"
|
||||
));
|
||||
|
||||
private HttpHelper() {
|
||||
|
|
|
@ -33,10 +33,10 @@ public final class URIResultParser extends ResultParser {
|
|||
"(/|\\?|$)"; // query, path or nothing
|
||||
private static final Pattern URL_WITH_PROTOCOL_PATTERN = Pattern.compile(
|
||||
"[a-zA-Z0-9]{2,}://" + // protocol
|
||||
"[a-zA-Z0-9\\-]{2,}(\\.[a-zA-Z0-9\\-]{2,})*" + // host name elements
|
||||
"[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)*" + // host name elements
|
||||
PATTERN_END);
|
||||
private static final Pattern URL_WITHOUT_PROTOCOL_PATTERN = Pattern.compile(
|
||||
"[a-zA-Z0-9\\-]{2,}(\\.[a-zA-Z0-9\\-]{2,})+" + // host name elements
|
||||
"([a-zA-Z0-9\\-]+\\.)+[a-zA-Z0-9\\-]{2,}" + // host name elements
|
||||
PATTERN_END);
|
||||
|
||||
@Override
|
||||
|
|
|
@ -48,6 +48,7 @@ public final class URIParsedResultTestCase extends Assert {
|
|||
"otpauth://remoteaccess?devaddr=00%a1b2%c3d4&devname=foo&key=bar",
|
||||
null);
|
||||
doTest("s3://amazon.com:8123", "s3://amazon.com:8123", null);
|
||||
doTest("HTTP://R.BEETAGG.COM/?12345", "http://R.BEETAGG.COM/?12345", null);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in a new issue