Skip to content

Commit

Permalink
Add backwards compatible for base64 URLs (qzind#661)
Browse files Browse the repository at this point in the history
Closes qzind#660
  • Loading branch information
tresf authored Jun 5, 2020
1 parent 45ceb92 commit 9b55aed
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/qz/printer/action/PrintRaw.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ public void parseData(JSONArray printData, PrintOptions options) throws JSONExce
private ImageWrapper getImageWrapper(String data, JSONObject opt, boolean fromFile) throws IOException {
BufferedImage bi;

// 2.0 compat
if (data.startsWith("data:image/") && data.contains(";base64,")) {
String[] parts = data.split(";base64,");
data = parts[parts.length - 1];
fromFile = false;
}

if (fromFile) {
bi = ImageIO.read(ConnectionUtilities.getInputStream(data));
} else {
Expand Down

0 comments on commit 9b55aed

Please sign in to comment.