From 7536322e530586b333dd2985f1f0592883d53612 Mon Sep 17 00:00:00 2001 From: Prospector <6166773+Prospector@users.noreply.github.com> Date: Wed, 11 Jan 2023 12:49:13 -0800 Subject: [PATCH] Remove numbers at the start of slugs when converting to mod ID (#897) * Remove numbers at the start of slugs when converting to mod ID * If mod id is all digits, replace with project ID --- plugins/fileUtils.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/fileUtils.js b/plugins/fileUtils.js index 973d63c3a..8b930ae9a 100644 --- a/plugins/fileUtils.js +++ b/plugins/fileUtils.js @@ -376,9 +376,12 @@ export const createDataPackVersion = async function ( ? version.version_number : `1-${version.version_number}` + const targetStartingDigitsRegex = /^(\d+)(\D+)$/g const newSlug = `${project.slug .replace('-', '_') .replace(/\W/g, '') + .replace(targetStartingDigitsRegex, '$2') + .replace(/^(\d+)$/g, project.id.replace(targetStartingDigitsRegex, '$2')) .substring(0, 63)}_mr` const iconPath = `${project.slug}_pack.png`