mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 04:54:04 -08:00
Issue #142 : fix escaping of %f / %t
This commit is contained in:
parent
7a0ff2305f
commit
5a07783224
|
@ -467,19 +467,18 @@ public abstract class ResultHandler {
|
|||
} catch (UnsupportedEncodingException e) {
|
||||
// can't happen; UTF-8 is always supported. Continue, I guess, without encoding
|
||||
}
|
||||
String url = text;
|
||||
String url = customProductSearch;
|
||||
if (rawResult != null) {
|
||||
// Replace %f but only if it doesn't seem to be a hex escape sequence. This remains
|
||||
// problematic but avoids the more surprising problem of breaking escapes
|
||||
url = url.replace("%f(?![0-9a-f])", rawResult.getBarcodeFormat().toString());
|
||||
url = url.replaceFirst("%f(?![0-9a-f])", rawResult.getBarcodeFormat().toString());
|
||||
if (url.contains("%t")) {
|
||||
ParsedResult parsedResultAgain = ResultParser.parseResult(rawResult);
|
||||
url = url.replace("%t", parsedResultAgain.getType().toString());
|
||||
}
|
||||
}
|
||||
// Replace %s last as it might contain itself %f or %t
|
||||
url = customProductSearch.replace("%s", url);
|
||||
return url;
|
||||
return url.replace("%s", text);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
</parent>
|
||||
|
||||
<properties>
|
||||
<gwt.version>2.6.0</gwt.version>
|
||||
<gwt.version>2.6.1-rc2</gwt.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
|
|
Loading…
Reference in a new issue