mirror of https://github.com/perkeep/perkeep.git
client: make Fetch return os.ErrNotExist on 404, per blob.Fetcher contract
Change-Id: I8a554c6facb34f2257e3e6035030e404a051ec50
This commit is contained in:
parent
d251a9b367
commit
eeb8f61dd3
|
@ -22,6 +22,8 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"net/http"
|
||||
"os"
|
||||
"regexp"
|
||||
|
||||
"camlistore.org/pkg/blob"
|
||||
|
@ -103,8 +105,11 @@ func (c *Client) FetchVia(b blob.Ref, v []blob.Ref) (body io.ReadCloser, size ui
|
|||
resp.Body.Close()
|
||||
}
|
||||
}()
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
if resp.StatusCode == http.StatusNotFound {
|
||||
// Per blob.Fetcher contract:
|
||||
return nil, 0, os.ErrNotExist
|
||||
}
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return nil, 0, fmt.Errorf("Got status code %d from blobserver for %s", resp.StatusCode, b)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue