Fix issue where sb2s originally from sb1s sometimes have baseLayerMd5 formatted incorrectly.

This commit is contained in:
Karishma Chadha 2018-12-10 18:17:24 -05:00
parent 532e63da15
commit eeac4e62f6

View file

@ -442,7 +442,15 @@ const parseScratchObject = function (object, runtime, extensions, topLevel, zip)
const md5ext = costumeSource.baseLayerMD5; const md5ext = costumeSource.baseLayerMD5;
const idParts = StringUtil.splitFirst(md5ext, '.'); const idParts = StringUtil.splitFirst(md5ext, '.');
const md5 = idParts[0]; const md5 = idParts[0];
const ext = idParts[1].toLowerCase(); let ext;
if (idParts.length === 2 && idParts[1]) {
ext = idParts[1];
} else {
// Default to 'png' if baseLayerMD5 is not formatted correctly
ext = 'png';
// Fix costume md5 for later
costume.md5 = `${costume.md5}.${ext}`;
}
costume.dataFormat = ext; costume.dataFormat = ext;
costume.assetId = md5; costume.assetId = md5;
if (costumeSource.textLayerMD5) { if (costumeSource.textLayerMD5) {