From fac6cf8c319e7010663f5390fa6174202d79d73f Mon Sep 17 00:00:00 2001 From: itsmeow Date: Fri, 6 Mar 2020 13:35:12 -0500 Subject: [PATCH] Fix type id slug parsing --- .github/workflows/test.yml | 2 +- curseforge-upload.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 77fa844..3066c80 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,5 @@ name: Test -# + on: push: paths: diff --git a/curseforge-upload.js b/curseforge-upload.js index c58cb17..fe2407d 100644 --- a/curseforge-upload.js +++ b/curseforge-upload.js @@ -14,7 +14,10 @@ async function getGameVersions(token, endpoint) { } else { if(valStr.includes(':')) { let valStrSp = valStr.split(':'); - gameVersionNames[valStrSp[0]] = valStrSp[1]; + if(valStrSp.length != 2) { + core.setFailed("Invalid game version type id pair: " + valStr + " - Valid Format: typeid:versionid"); + } + gameVersionNames[valStrSp[1]] = valStrSp[0]; } else { gameVersionNames[valStr] = "blank"; } @@ -44,7 +47,7 @@ async function getGameVersions(token, endpoint) { const versionTypeData = Object.values(gameVersionNames).filter((v,i,a) => v != "blank").length > 0 ? JSON.parse(await requestPromise(optionsTypes)) : []; const filteredVersions = versionData.filter(function(value, index, array) { - + let typeId = gameVersionNames.hasOwnProperty(value.name) ? gameVersionNames[value.name] : (gameVersionNames.hasOwnProperty(value.slug) ? gameVersionNames[value.slug] : ""); if(typeId != null && typeId != "blank" && typeId != "") { if(isID(typeId)) {