From c0afcd2ab3fa60afd7d0a6a9c43ac27fe3028e16 Mon Sep 17 00:00:00 2001 From: Karishma Chadha Date: Mon, 5 Mar 2018 15:16:00 -0500 Subject: [PATCH] Ensure that md5 and assetId stay in sync. --- src/serialization/serialize-assets.js | 2 +- src/virtual-machine.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/serialization/serialize-assets.js b/src/serialization/serialize-assets.js index d001baa0e..674b29f42 100644 --- a/src/serialization/serialize-assets.js +++ b/src/serialization/serialize-assets.js @@ -19,7 +19,7 @@ const serializeAssets = function (runtime, assetType) { const storage = runtime.storage; const storedAsset = storage.get(assetId); assetDescs.push({ - fileName: assetType === 'sound' ? + fileName: currAsset.md5 ? currAsset.md5 : `${assetId}.${storedAsset.dataFormat}`, fileContent: storedAsset.data}); } diff --git a/src/virtual-machine.js b/src/virtual-machine.js index 797a68f87..6d97dfe46 100644 --- a/src/virtual-machine.js +++ b/src/virtual-machine.js @@ -537,6 +537,7 @@ class VirtualMachine extends EventEmitter { // If we're in here, we've edited an svg in the vector editor, // so the dataFormat should be 'svg' costume.dataFormat = storage.DataFormat.SVG; + costume.md5 = `${costume.assetId}.${costume.dataFormat}`; this.emitTargetsUpdate(); }