mirror of https://github.com/perkeep/perkeep.git
pkg/index: on slurping bogus gps coordinate, log instead of panicking
If a GPS coordinate is bogus, we should have caught it when receiving the blob, and not write it out as an index row. If we did not, we end up catching it when trying to slurp it to the corpus. At this point there's no reason to penalize the user by panicking, we can instead skip it and log about the error. Change-Id: Ie40479befca78d8b5da343ef1a8420f703f07cb7
This commit is contained in:
parent
66e6766571
commit
1aeadf4a8a
|
@ -845,7 +845,12 @@ func (c *Corpus) mergeEXIFGPSRow(k, v []byte) error {
|
|||
lat, err := strconv.ParseFloat(string(v[:pipe]), 64)
|
||||
long, err1 := strconv.ParseFloat(string(v[pipe+1:]), 64)
|
||||
if err != nil || err1 != nil {
|
||||
return fmt.Errorf("bogus row %q = %q", k, v)
|
||||
if err != nil {
|
||||
log.Printf("index: bogus latitude in value of row %q = %q", k, v)
|
||||
} else {
|
||||
log.Printf("index: bogus longitude in value of row %q = %q", k, v)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
c.gps[wholeRef] = latLong{lat, long}
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue