Skip to content

Commit

Permalink
fix: enforce maximum of 1 version element in each package
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarvin8 committed Nov 12, 2024
1 parent 8918c0a commit 48a87de
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/helpers/parsePackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ export async function parsePackageXml(xmlContent: string): Promise<SalesforcePac
});
}

// Handle 'version' being an array, string, or undefined
// Enforce a maximum of one <version> tag in the package.xml
if (parsed.Package && Array.isArray(parsed.Package.version)) {
if (parsed.Package.version.length > 1) {
return null; // Invalid structure, more than one <version> tag
}
// Convert to a single string if only one <version> tag is present
parsed.Package.version = parsed.Package.version[0];
}

Expand Down

0 comments on commit 48a87de

Please sign in to comment.