mirror of
https://github.com/anchore/syft
synced 2024-11-12 23:27:20 +00:00
Merge pull request #85 from anchore/issue-84
Remove carriage returns from distro files
This commit is contained in:
commit
f03f7b32e9
3 changed files with 15 additions and 2 deletions
|
@ -92,9 +92,9 @@ func parseOsRelease(contents string) *Distro {
|
|||
|
||||
switch prefix {
|
||||
case "ID":
|
||||
id = value
|
||||
id = strings.TrimSpace(value)
|
||||
case "VERSION_ID":
|
||||
vers = value
|
||||
vers = strings.TrimSpace(value)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,11 @@ func TestParseOsRelease(t *testing.T) {
|
|||
name: "redhat",
|
||||
RawVersion: "8.1",
|
||||
},
|
||||
{
|
||||
fixture: "test-fixtures/unprintable",
|
||||
name: "debian",
|
||||
RawVersion: "8",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
|
8
imgbom/distro/test-fixtures/unprintable
Normal file
8
imgbom/distro/test-fixtures/unprintable
Normal file
|
@ -0,0 +1,8 @@
|
|||
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
|
||||
NAME="Debian GNU/Linux"
|
||||
VERSION_ID="8"
|
||||
VERSION="8 (jessie)"
|
||||
ID=debian
|
||||
HOME_URL="http://www.debian.org/"
|
||||
SUPPORT_URL="http://www.debian.org/support"
|
||||
BUG_REPORT_URL="https://bugs.debian.org/"
|
Loading…
Reference in a new issue