mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 11:47:26 -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();
|
imageURIString = imageURIString.trim();
|
||||||
|
|
||||||
if (!(imageURIString.startsWith("http://") || imageURIString.startsWith("https://"))) {
|
|
||||||
imageURIString = "http://" + imageURIString;
|
|
||||||
}
|
|
||||||
|
|
||||||
URI imageURI;
|
URI imageURI;
|
||||||
try {
|
try {
|
||||||
imageURI = new URI(imageURIString);
|
imageURI = new URI(imageURIString);
|
||||||
} catch (URISyntaxException ignored) {
|
// Assume http: if not specified
|
||||||
log.info("URI was not valid: " + imageURIString);
|
if (imageURI.getScheme() == null) {
|
||||||
|
imageURI = new URI("http://" + imageURIString);
|
||||||
|
}
|
||||||
|
} catch (URISyntaxException urise) {
|
||||||
|
log.info("URI " + imageURIString + " was not valid: " + urise);
|
||||||
response.sendRedirect("badurl.jspx");
|
response.sendRedirect("badurl.jspx");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -144,8 +144,8 @@ public final class DecodeServlet extends HttpServlet {
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
log.info(ioe.toString());
|
log.info(ioe.toString());
|
||||||
response.sendRedirect("badurl.jspx");
|
response.sendRedirect("badurl.jspx");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
URL imageURL;
|
URL imageURL;
|
||||||
|
|
Loading…
Reference in a new issue