Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/j_develop_createAsset' into j_de…
Browse files Browse the repository at this point in the history
…velop_createAsset
  • Loading branch information
Jmr3366 committed Oct 11, 2024
2 parents 3ae2ae2 + 557bade commit cbcf135
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,20 @@ public Object childEvaluate(
FunctionUtil.checkNumberParam(functionName, args, 2, 2);
String imageName = args.get(0).toString();
String imageString = args.get(1).toString();
if (imageName.isEmpty() || imageString.isEmpty()) {
if (imageName.isEmpty() || imageString.isEmpty()) {
throw new ParserException(
I18N.getText("macro.function.general.paramCannotBeEmpty", functionName));
} else if(imageString.length() > 8) {
I18N.getText("macro.function.general.paramCannotBeEmpty", functionName));
} else if (imageString.length() > 8) {
byte[] imageBytes = Base64.decode(imageString);
String imageCheck;
try {
imageCheck = new String(imageBytes, 0, 4);
} catch (Exception e) {
throw new ParserException(I18N.getText("dragdrop.unsupportedType", functionName));
}
if (imageCheck.equals(FILE_HEADER_WEBP) || imageCheck.equals(FILE_HEADER_JPG) || imageCheck.equals(FILE_HEADER_PNG)) {
if (imageCheck.equals(FILE_HEADER_WEBP)
|| imageCheck.equals(FILE_HEADER_JPG)
|| imageCheck.equals(FILE_HEADER_PNG)) {
Asset asset = Asset.createImageAsset(imageName, imageBytes);
AssetManager.putAsset(asset);
assetId.append(asset.getMD5Key().toString());
Expand All @@ -202,7 +204,7 @@ public Object childEvaluate(
}
} else {
throw new ParserException(
I18N.getText("macro.function.general.wrongParamType", functionName));
I18N.getText("macro.function.general.wrongParamType", functionName));
}
}

Expand Down

0 comments on commit cbcf135

Please sign in to comment.