Improve parsing candidates with missing Foundation

Support missing foundation candidates with additional attributes

Resolves #390
This commit is contained in:
Sean DuBois
2021-12-25 22:53:35 -05:00
parent 715f208310
commit bdb23b0bf4
+3 -3
View File
@@ -424,11 +424,11 @@ func (c *candidateBase) Marshal() string {
// UnmarshalCandidate creates a Candidate from its string representation
func UnmarshalCandidate(raw string) (Candidate, error) {
split := strings.Fields(raw)
switch {
// Foundation not specified: not RFC 8445 compliant but seen in the wild
case len(split) == 7 && raw[0] == ' ':
if len(raw) != 0 && raw[0] == ' ' {
split = append([]string{" "}, split...)
case len(split) < 8:
}
if len(split) < 8 {
return nil, fmt.Errorf("%w (%d)", errAttributeTooShortICECandidate, len(split))
}