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.
This commit is contained in:
Emi Matchu 2020-09-22 03:46:32 -07:00
parent 507d0709e4
commit a4d159381c

View file

@ -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`,