mirror of
https://github.com/zxing/zxing.git
synced 2025-01-13 20:27:34 -08:00
Issue 706 user-suggested patch for trimming bad whitespace on URI
git-svn-id: https://zxing.googlecode.com/svn/trunk@1712 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
f53c4d532b
commit
a55e645bfe
|
@ -79,6 +79,7 @@ public final class URIParsedResult extends ParsedResult {
|
||||||
* the protocol.
|
* the protocol.
|
||||||
*/
|
*/
|
||||||
private static String massageURI(String uri) {
|
private static String massageURI(String uri) {
|
||||||
|
uri = uri.trim();
|
||||||
int protocolEnd = uri.indexOf(':');
|
int protocolEnd = uri.indexOf(':');
|
||||||
if (protocolEnd < 0) {
|
if (protocolEnd < 0) {
|
||||||
// No protocol, assume http
|
// No protocol, assume http
|
||||||
|
|
|
@ -34,6 +34,9 @@ final class URIResultParser extends ResultParser {
|
||||||
if (rawText != null && rawText.startsWith("URL:")) {
|
if (rawText != null && rawText.startsWith("URL:")) {
|
||||||
rawText = rawText.substring(4);
|
rawText = rawText.substring(4);
|
||||||
}
|
}
|
||||||
|
if (rawText != null) {
|
||||||
|
rawText = rawText.trim();
|
||||||
|
}
|
||||||
if (!isBasicallyValidURI(rawText)) {
|
if (!isBasicallyValidURI(rawText)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue