From 9b55aed267df6a7abdcf437d84610fa19a2fda76 Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Fri, 5 Jun 2020 15:11:08 -0400 Subject: [PATCH] Add backwards compatible for base64 URLs (#661) Closes #660 --- src/qz/printer/action/PrintRaw.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/qz/printer/action/PrintRaw.java b/src/qz/printer/action/PrintRaw.java index 6dcc87b40..b80867eb7 100644 --- a/src/qz/printer/action/PrintRaw.java +++ b/src/qz/printer/action/PrintRaw.java @@ -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 {