fix: trim path from deps.json in portable way (#2674)

* fix: trim path from deps.json in portable way

Previously, the path trimming regex would leave leading path separator
in place on Windows.

Probably a better long term fix is to a library path operation.

Signed-off-by: Will Murphy <will.murphy@anchore.com>
This commit is contained in:
William Murphy
2024-02-29 09:31:55 -05:00
committed by GitHub
parent 5ef83fdc79
commit 3ad91f2678
2 changed files with 41 additions and 1 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ func newDotnetDepsPackage(nameVersion string, lib dotnetDepsLibrary, locations .
}
func getDepsJSONFilePrefix(p string) string {
r := regexp.MustCompile(`([^\/]+)\.deps\.json$`)
r := regexp.MustCompile(`([^\\\/]+)\.deps\.json$`)
match := r.FindStringSubmatch(p)
if len(match) > 1 {
return match[1]