diff --git a/host/host_linux.go b/host/host_linux.go index 96f71335b..09865b908 100644 --- a/host/host_linux.go +++ b/host/host_linux.go @@ -179,14 +179,24 @@ func getOSRelease() (platform string, version string, err error) { } switch field[0] { case "ID": // use ID for lowercase - platform = field[1] + platform = trimQuotes(field[1]) case "VERSION": - version = field[1] + version = trimQuotes(field[1]) } } return platform, version, nil } +// trimQuotes removes quotes in the source string. +func trimQuotes(s string) string { + if len(s) >= 2 { + if s[0] == '"' && s[len(s)-1] == '"' { + return s[1 : len(s)-1] + } + } + return s +} + func getLSB() (*LSB, error) { ret := &LSB{} if common.PathExistsWithContents(common.HostEtc("lsb-release")) {