From baab36bfc56a87e5da933af39bbf0be5f3e3f691 Mon Sep 17 00:00:00 2001 From: Daniel Jennings <582974+danieljennings@users.noreply.github.com> Date: Sat, 8 Feb 2020 13:41:33 -0800 Subject: [PATCH] Trim schematic string before calling Base64Decoder (#1537) This fixes getting the "Length of Base64 encoded input string is not a multiple of 4." error when importing schematics that have whitespace at the start/end of them, which is easy to accidentally have without knowing by when copying the schematic codes from random different web pages. --- core/src/mindustry/game/Schematics.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/game/Schematics.java b/core/src/mindustry/game/Schematics.java index 7a96ed672b..74a8a6f0bd 100644 --- a/core/src/mindustry/game/Schematics.java +++ b/core/src/mindustry/game/Schematics.java @@ -375,7 +375,7 @@ public class Schematics implements Loadable{ /** Loads a schematic from base64. May throw an exception. */ public static Schematic readBase64(String schematic){ try{ - return read(new ByteArrayInputStream(Base64Coder.decode(schematic))); + return read(new ByteArrayInputStream(Base64Coder.decode(schematic.trim()))); }catch(IOException e){ throw new RuntimeException(e); }