Skip to content

Commit

Permalink
Three fixes (#3108)
Browse files Browse the repository at this point in the history
* Three fixes:
1) Split on FindingProviderFields.Types where there might have been
   fewer than 3 slashes.
2) Fix for filenames (on at least windows) by swapping the bar with a
   hyphen.
3) Fix the refs.urls where the transform wasn't working properly.

Signed-off-by: Amndeep Singh Mann <[email protected]>

* linting

Signed-off-by: Amndeep Singh Mann <[email protected]>
  • Loading branch information
Amndeep7 authored Jun 1, 2022
1 parent f7c2f6e commit 445f962
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions libs/hdf-converters/src/asff-mapper/asff-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ function whichSpecialCase(finding: Record<string, unknown>): SpecialCasing {
_.some(
_.get(finding, 'FindingProviderFields.Types') as string[],
(type: string) => {
const version = type.split('/')[2].split('-')[0];
const delimitedType = type.split('/');
const version = delimitedType[delimitedType.length - 1].split('-')[0];
const [major, minor, patch] = version.split('.');
if (
parseInt(major) > 1 &&
Expand Down Expand Up @@ -303,7 +304,7 @@ export class ASFFMapper extends BaseConverter {
.split(':')
.slice(-1)[0]
.split('/');
const defaultTargetId = `${productInfo[1]} | ${productInfo[2]}`;
const defaultTargetId = `${productInfo[1]} - ${productInfo[2]}`;
return externalProductHandler(
this,
whichSpecialCase(
Expand Down Expand Up @@ -451,9 +452,7 @@ export class ASFFMapper extends BaseConverter {
): Record<string, unknown> => {
return {
...(_.has(finding, 'SourceUrl') && {
url: {
path: 'SourceUrl'
}
url: _.get(finding, 'SourceUrl')
})
};
}
Expand Down Expand Up @@ -668,7 +667,7 @@ export class ASFFResults {
.split(':')
.slice(-1)[0]
.split('/');
const defaultFilename = `${productInfo[1]} | ${productInfo[2]}.json`;
const defaultFilename = `${productInfo[1]} - ${productInfo[2]}.json`;
return externalProductHandler(
this,
whichSpecialCase(finding),
Expand Down

0 comments on commit 445f962

Please sign in to comment.