Skip to content

Commit

Permalink
Fix issues parsing Int and Float (r0adkll#145)
Browse files Browse the repository at this point in the history
Undefined was transformed into NaN, which is not undefined and thus failed validation
  • Loading branch information
boswelja authored Sep 24, 2022
1 parent 7cd1379 commit 99b7a1e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/edits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface EditOptions {
applicationId: string;
track: string;
inAppUpdatePriority: number;
userFraction: number;
userFraction?: number;
whatsNewDir?: string;
mappingFile?: string;
debugSymbols?: string;
Expand Down
14 changes: 12 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,24 @@ async function run() {
await validateServiceAccountJson(serviceAccountJsonRaw, serviceAccountJson)

// Validate user fraction
const userFractionFloat = parseFloat(userFraction)
let userFractionFloat: number | undefined
if (userFraction) {
userFractionFloat = parseFloat(userFraction)
} else {
userFractionFloat = undefined
}
await validateUserFraction(userFractionFloat)

// Validate release status
await validateStatus(status, userFraction != undefined)

// Validate the inAppUpdatePriority to be a valid number in within [0, 5]
const inAppUpdatePriorityInt: number | undefined = parseInt(inAppUpdatePriority);
let inAppUpdatePriorityInt: number | undefined
if (inAppUpdatePriority) {
inAppUpdatePriorityInt = parseInt(inAppUpdatePriority)
} else {
inAppUpdatePriorityInt = undefined
}
await validateInAppUpdatePriority(inAppUpdatePriorityInt)

// Check release files while maintaining backward compatibility
Expand Down

0 comments on commit 99b7a1e

Please sign in to comment.