Skip to content

Commit

Permalink
Fix type id slug parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmeow committed Mar 6, 2020
1 parent e2d12a9 commit fac6cf8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Test
#

on:
push:
paths:
Expand Down
7 changes: 5 additions & 2 deletions curseforge-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit fac6cf8

Please sign in to comment.