Fix moderation queue, moderation status card when approved, and invalid datapack packages (#907)

* Fool behavior

* Add leading underscore to packaged datapack package if it starts with a number

* Hide mod status card for all approved statuses without mod messages

* Fix project id sanitization
This commit is contained in:
Prospector
2023-01-11 15:21:39 -08:00
committed by GitHub
parent c67bc33c23
commit 17f00e6fea
4 changed files with 20 additions and 10 deletions

View File

@@ -514,12 +514,20 @@ export const createDataPackVersion = async function (
binary += String.fromCharCode(classFile[i])
}
let sanitizedId = project.id
if (project.id.match(/^(\d+)/g)) {
sanitizedId = '_' + sanitizedId
}
sanitizedId = sanitizedId.substring(0, 8)
binary = binary
.replace(
String.fromCharCode(32) + 'needs1to1be1changed1modrinth1mod',
String.fromCharCode(newSlug.length) + newSlug
)
.replace('/wrappera/', `/${project.id.substring(0, 8)}/`)
.replace('/wrappera/', `/${sanitizedId}/`)
const newArr = []
for (let i = 0; i < binary.length; i++) {
@@ -527,7 +535,7 @@ export const createDataPackVersion = async function (
}
primaryZipReader.file(
`com/modrinth/${project.id.substring(0, 8)}/ModrinthWrapper.class`,
`com/modrinth/${sanitizedId}/ModrinthWrapper.class`,
new Uint8Array(newArr)
)
}