Skip to content

Commit

Permalink
Lily/Assets: fix addCostume corruption (#1643)
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin authored Aug 6, 2024
1 parent dfb5354 commit 23e5c1a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion extensions/Lily/Assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,14 @@
const assetType = this._typeIsBitmap(blob.type)
? runtime.storage.AssetType.ImageBitmap
: runtime.storage.AssetType.ImageVector;

// Bitmap data format is not actually enforced, but setting it to something that isn't in scratch-parser's
// known format list will throw an error when someone tries to load the project.
// (https://github.com/scratchfoundation/scratch-parser/blob/665f05d739a202d565a4af70a201909393d456b2/lib/sb3_definitions.json#L51)
const dataType =
blob.type === "image/svg+xml" ? "svg" : blob.type.split("/")[1];
blob.type === "image/svg+xml"
? runtime.storage.DataFormat.SVG
: runtime.storage.DataFormat.PNG;

const arrayBuffer = await new Promise((resolve, reject) => {
const fr = new FileReader();
Expand Down

0 comments on commit 23e5c1a

Please sign in to comment.