diff options
Diffstat (limited to 'gopher/gophermap')
-rw-r--r-- | gopher/gophermap/parse.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/gopher/gophermap/parse.go b/gopher/gophermap/parse.go index e99fec6..daa458b 100644 --- a/gopher/gophermap/parse.go +++ b/gopher/gophermap/parse.go @@ -24,14 +24,11 @@ func Parse(input io.Reader) (gopher.MapDocument, error) { return nil, err } - if len(line) > 2 && !bytes.Equal(line, []byte(".\r\n")) { - if line[len(line)-2] != '\r' || line[len(line)-1] != '\n' { - return nil, InvalidLine(num) - } - + line = bytes.TrimSuffix(bytes.TrimSuffix(line, []byte{'\n'}), []byte{'\r'}) + if len(line) > 0 && !bytes.Equal(line, []byte(".")) { item := gopher.MapItem{Type: sr.Status(line[0])} - spl := bytes.Split(line[1:len(line)-2], []byte{'\t'}) + spl := bytes.Split(line[1:], []byte{'\t'}) if item.Type != gopher.InfoMessageType && len(spl) != 4 { return nil, InvalidLine(num) } |