From a4d159381c1f29a8059e31974e652a430c8d688e Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 22 Sep 2020 03:46:32 -0700 Subject: [PATCH] add an underscore to numbered filenames Here's an example, the file is http://images.neopets.com/cp/items/data/000/000/546/546022_1132b0ffeb/546022.js and the constructor is _546022, to account for the fact that JS syntax won't allow a plain number there. --- src/app/components/OutfitCanvas.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/components/OutfitCanvas.js b/src/app/components/OutfitCanvas.js index efed053..1ee4204 100644 --- a/src/app/components/OutfitCanvas.js +++ b/src/app/components/OutfitCanvas.js @@ -213,6 +213,9 @@ export function OutfitCanvasMovie({ librarySrc, zIndex }) { const fileName = librarySrc.split("/").pop(); const fileNameWithoutExtension = fileName.split(".")[0]; constructorName = fileNameWithoutExtension.replace(/[ -]/g, ""); + if (constructorName.match(/^[0-9]+$/)) { + constructorName = "_" + constructorName; + } } catch (e) { console.error( `Movie librarySrc %s did not match expected format: %o`,