From de974a365b1a2fb7e8356f7473615cca54157c7b Mon Sep 17 00:00:00 2001 From: Matchu Date: Wed, 28 Oct 2020 00:29:32 -0700 Subject: [PATCH] fix bug with items with %20 in movie clip URL "Beautiful Green Painting Background" wasn't loading! https://impress-2020.openneo.net/items/75594 ```Error building movie clips Error: Expected JS movie library http://images.neopets.com/cp/items/data/000/000/491/491273_31368b3745/491273_2_HTML5%20Canvas.js to contain a constructor named _491273_2_HTML5%20Canvas, but it did not: ssMetadata,Bitmap3,Bitmap5,CachedTexturedBitmap_4183,CachedTexturedBitmap_4184,CachedTexturedBitmap_4185,CachedTexturedBitmap_4186,CachedTexturedBitmap_4187,Symbol20,Symbol8,Symbol4,Symbol7,Symbol2,Symbol1,Symbol9,Symbol2copy,Symbol2_1,_491273_2_HTML5Canvas,properties,Stage``` We already had code to strip out spaces, but not encoded spaces like %20. Now, we decode the URL first, so that space-stripping will work even if it was encoded. --- src/app/components/OutfitMovieLayer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/OutfitMovieLayer.js b/src/app/components/OutfitMovieLayer.js index 7b0d4ee..9e995b3 100644 --- a/src/app/components/OutfitMovieLayer.js +++ b/src/app/components/OutfitMovieLayer.js @@ -264,7 +264,7 @@ export async function loadMovieLibrary(librarySrc) { export function buildMovieClip(library, libraryUrl) { let constructorName; try { - const fileName = libraryUrl.split("/").pop(); + const fileName = decodeURI(libraryUrl).split("/").pop(); const fileNameWithoutExtension = fileName.split(".")[0]; constructorName = fileNameWithoutExtension.replace(/[ -]/g, ""); if (constructorName.match(/^[0-9]/)) {