mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 03:37:34 -08:00
Fix and improve last commit for data URIs
git-svn-id: https://zxing.googlecode.com/svn/trunk@2683 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
13d97af689
commit
57dc2ca742
|
@ -123,15 +123,15 @@ public final class DecodeServlet extends HttpServlet {
|
|||
|
||||
imageURIString = imageURIString.trim();
|
||||
|
||||
if (!(imageURIString.startsWith("http://") || imageURIString.startsWith("https://"))) {
|
||||
imageURIString = "http://" + imageURIString;
|
||||
}
|
||||
|
||||
URI imageURI;
|
||||
try {
|
||||
imageURI = new URI(imageURIString);
|
||||
} catch (URISyntaxException ignored) {
|
||||
log.info("URI was not valid: " + imageURIString);
|
||||
// Assume http: if not specified
|
||||
if (imageURI.getScheme() == null) {
|
||||
imageURI = new URI("http://" + imageURIString);
|
||||
}
|
||||
} catch (URISyntaxException urise) {
|
||||
log.info("URI " + imageURIString + " was not valid: " + urise);
|
||||
response.sendRedirect("badurl.jspx");
|
||||
return;
|
||||
}
|
||||
|
@ -144,8 +144,8 @@ public final class DecodeServlet extends HttpServlet {
|
|||
} catch (IOException ioe) {
|
||||
log.info(ioe.toString());
|
||||
response.sendRedirect("badurl.jspx");
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
URL imageURL;
|
||||
|
|
Loading…
Reference in a new issue