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
This commit is contained in:
parent
b690e3d149
commit
7536322e53
@ -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`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user