Improve support for bad servers and hand-written/broken Gopher menus
This commit is contained in:
parent
d5262b612a
commit
b02b629fe9
@ -197,8 +197,12 @@ func (i *Item) parse(line []byte) error {
|
||||
|
||||
port, err := strconv.Atoi(string(parts[3]))
|
||||
if err != nil {
|
||||
// Ignore parsing errors for bad servers for INFO types
|
||||
if i.Type != INFO {
|
||||
return err
|
||||
}
|
||||
port = 0
|
||||
}
|
||||
i.Port = port
|
||||
|
||||
if len(parts) >= 4 {
|
||||
@ -379,7 +383,8 @@ func (i *Item) FetchDirectory() (Directory, error) {
|
||||
var i Item
|
||||
err := i.parse(line)
|
||||
if err != nil {
|
||||
return d, err
|
||||
log.Printf("Error parsing %q: %q", line, err)
|
||||
continue
|
||||
}
|
||||
d = append(d, i)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user