mirror of
https://github.com/anchore/syft.git
synced 2026-02-12 02:26:42 +01:00
fix: remove cabal.project.freeze panic on last pkg (#1363)
This commit is contained in:
parent
bcfe38c009
commit
b290a445ca
@ -34,6 +34,14 @@ func parseCabalFreeze(_ source.FileResolver, _ *generic.Environment, reader sour
|
||||
|
||||
line = strings.TrimSpace(line)
|
||||
startPkgEncoding, endPkgEncoding := strings.Index(line, "any.")+4, strings.Index(line, ",")
|
||||
// case where comma not found for last package in constraint list
|
||||
if endPkgEncoding == -1 {
|
||||
endPkgEncoding = len(line)
|
||||
}
|
||||
if startPkgEncoding >= endPkgEncoding || startPkgEncoding < 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
line = line[startPkgEncoding:endPkgEncoding]
|
||||
fields := strings.Split(line, " ==")
|
||||
|
||||
|
||||
@ -12,6 +12,6 @@ constraints: any.Cabal ==3.2.1.0,
|
||||
any.RSA ==2.4.1,
|
||||
any.SHA ==1.6.4.4,
|
||||
void -safe,
|
||||
any.Spock ==0.14.0.0,
|
||||
any.Spock ==0.14.0.0
|
||||
|
||||
index-state: hackage.haskell.org 2022-07-07T01:01:53Z
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user