fix: ignore client providing not-an-id in recipe ids array (#1990)
All checks were successful
Build Docker image / docker (push) Successful in 33s
Build / build (push) Successful in 1m44s

Closes #1989

Reviewed-on: #1990
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
Sainan 2025-05-06 02:29:23 -07:00 committed by Sainan
parent da6d75c748
commit f6cbc02c47

View File

@ -41,7 +41,7 @@ export const startRecipeController: RequestHandler = async (req, res) => {
]; ];
for (let i = 0; i != recipe.ingredients.length; ++i) { for (let i = 0; i != recipe.ingredients.length; ++i) {
if (startRecipeRequest.Ids[i]) { if (startRecipeRequest.Ids[i] && startRecipeRequest.Ids[i][0] != "/") {
const category = ExportWeapons[recipe.ingredients[i].ItemType].productCategory; const category = ExportWeapons[recipe.ingredients[i].ItemType].productCategory;
if (category != "LongGuns" && category != "Pistols" && category != "Melee") { if (category != "LongGuns" && category != "Pistols" && category != "Melee") {
throw new Error(`unexpected equipment ingredient type: ${category}`); throw new Error(`unexpected equipment ingredient type: ${category}`);