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.
This commit is contained in:
Daniel Jennings 2020-02-08 13:41:33 -08:00 committed by GitHub
parent 3a2fef3bd7
commit baab36bfc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}