forked from TrueCloudLab/distribution
Replace 404 to http.StatusNotFound
Change-Id: Ia100975cb93c0a6d94ea5542b1c9ce386bc87649 Signed-off-by: weiyuan.yl <weiyuan.yl@alibaba-inc.com>
This commit is contained in:
parent
dc6944d91d
commit
5dc714b347
1 changed files with 4 additions and 4 deletions
|
@ -430,7 +430,7 @@ func (d *driver) WriteStream(ctx context.Context, path string, offset int64, rea
|
||||||
if offset > 0 {
|
if offset > 0 {
|
||||||
resp, err := d.Bucket.Head(d.ossPath(path), nil)
|
resp, err := d.Bucket.Head(d.ossPath(path), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if ossErr, ok := err.(*oss.Error); !ok || ossErr.StatusCode != 404 {
|
if ossErr, ok := err.(*oss.Error); !ok || ossErr.StatusCode != http.StatusNotFound {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -729,8 +729,8 @@ func (d *driver) URLFor(ctx context.Context, path string, options map[string]int
|
||||||
method, ok := options["method"]
|
method, ok := options["method"]
|
||||||
if ok {
|
if ok {
|
||||||
methodString, ok = method.(string)
|
methodString, ok = method.(string)
|
||||||
if !ok || (methodString != "GET" && methodString != "PUT") {
|
if !ok || (methodString != "GET") {
|
||||||
return "", storagedriver.ErrUnsupportedMethod{driverName}
|
return "", storagedriver.ErrUnsupportedMethod{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -754,7 +754,7 @@ func (d *driver) ossPath(path string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseError(path string, err error) error {
|
func parseError(path string, err error) error {
|
||||||
if ossErr, ok := err.(*oss.Error); ok && ossErr.StatusCode == 404 && (ossErr.Code == "NoSuchKey" || ossErr.Code == "") {
|
if ossErr, ok := err.(*oss.Error); ok && ossErr.StatusCode == http.StatusNotFound && (ossErr.Code == "NoSuchKey" || ossErr.Code == "") {
|
||||||
return storagedriver.PathNotFoundError{Path: path}
|
return storagedriver.PathNotFoundError{Path: path}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue