1
1
import spdxSatisfies from 'spdx-satisfies'
2
- import { Change , Changes } from './schemas'
3
- import { isSPDXValid , octokitClient } from './utils'
4
- import { PackageURL } from 'packageurl-js'
2
+ import { Change , Changes } from './schemas'
3
+ import { isSPDXValid , octokitClient } from './utils'
4
+ import { PackageURL } from 'packageurl-js'
5
5
6
6
/**
7
7
* Loops through a list of changes, filtering and returning the
@@ -29,10 +29,10 @@ export async function getInvalidLicenseChanges(
29
29
licenseExclusions ?: string [ ]
30
30
}
31
31
) : Promise < InvalidLicenseChanges > {
32
- const { allow, deny} = licenses
32
+ const { allow, deny } = licenses
33
33
const licenseExclusions = licenses . licenseExclusions ?. map (
34
34
( pkgUrl : string ) => {
35
- return PackageURL . fromString ( pkgUrl )
35
+ return PackageURL . fromString ( encodeURI ( pkgUrl ) )
36
36
}
37
37
)
38
38
@@ -45,7 +45,9 @@ export async function getInvalidLicenseChanges(
45
45
return true
46
46
}
47
47
48
- const changeAsPackageURL = PackageURL . fromString ( change . package_url )
48
+ const changeAsPackageURL = PackageURL . fromString (
49
+ encodeURI ( change . package_url )
50
+ )
49
51
50
52
// We want to find if the licenseExclussion list contains the PackageURL of the Change
51
53
// If it does, we want to filter it out and therefore return false
@@ -125,7 +127,7 @@ const fetchGHLicense = async (
125
127
}
126
128
}
127
129
128
- const parseGitHubURL = ( url : string ) : { owner : string ; repo : string } | null => {
130
+ const parseGitHubURL = ( url : string ) : { owner : string ; repo : string } | null => {
129
131
try {
130
132
const parsed = new URL ( url )
131
133
if ( parsed . host !== 'github.com' ) {
@@ -135,7 +137,7 @@ const parseGitHubURL = (url: string): {owner: string; repo: string} | null => {
135
137
if ( components . length < 3 ) {
136
138
return null
137
139
}
138
- return { owner : components [ 1 ] , repo : components [ 2 ] }
140
+ return { owner : components [ 1 ] , repo : components [ 2 ] }
139
141
} catch ( _ ) {
140
142
return null
141
143
}
0 commit comments