Skip to content

Commit

Permalink
fix: malformed ingested package versions are fixed (#1246)
Browse files Browse the repository at this point in the history
---------

Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
  • Loading branch information
jkowalleck authored Dec 10, 2023
1 parent decc6d8 commit 69780c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.

## unreleased

* Fix
* Malformed ingested package versions are fixed (via [#1246])

[#1246]: https://github.com/CycloneDX/cyclonedx-webpack-plugin/pull/1246

## 3.9.0 - 2023-12-10

* Changed
Expand Down
4 changes: 2 additions & 2 deletions src/extractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ export class Extractor {
const _packageJson = structuredClonePolyfill(pkg.packageJson)
normalizePackageJson(_packageJson as object /* add debug for warnings? */)
// region fix normalizations
if (typeof pkg.packageJson === 'string') {
if (typeof pkg.packageJson.version === 'string') {
// allow non-SemVer strings
_packageJson.version = pkg.packageJson.trim()
_packageJson.version = pkg.packageJson.version.trim()
}
// endregion fix normalizations
pkg.packageJson = _packageJson
Expand Down

0 comments on commit 69780c2

Please sign in to comment.