mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Issue 1157 support protocols ending with : not :// like bitcoin
git-svn-id: https://zxing.googlecode.com/svn/trunk@2178 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
c39eb3a817
commit
6261912024
|
@ -32,7 +32,7 @@ public final class URIResultParser extends ResultParser {
|
|||
"(:\\d{1,5})?" + // maybe port
|
||||
"(/|\\?|$)"; // 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,}:(/)*" + // protocol
|
||||
"[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)*" + // host name elements
|
||||
PATTERN_END);
|
||||
private static final Pattern URL_WITHOUT_PROTOCOL_PATTERN = Pattern.compile(
|
||||
|
|
|
@ -88,6 +88,11 @@ public final class URIParsedResultTestCase extends Assert {
|
|||
doTestIsPossiblyMalicious("http://google.com/@@", false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExotic() {
|
||||
doTest("bitcoin:mySD89iqpmptrK3PhHFW9fa7BXiP7ANy3Y", "bitcoin:mySD89iqpmptrK3PhHFW9fa7BXiP7ANy3Y", null);
|
||||
}
|
||||
|
||||
private static void doTest(String contents, String uri, String title) {
|
||||
Result fakeResult = new Result(contents, null, null, BarcodeFormat.QR_CODE);
|
||||
ParsedResult result = ResultParser.parseResult(fakeResult);
|
||||
|
|
Loading…
Reference in a new issue