mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-02 18:34:29 +08:00
fix: not found
This commit is contained in:
parent
6ea97e7bc6
commit
04dae35e4c
@ -23,6 +23,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/OpenIMSDK/tools/errs"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -229,7 +230,7 @@ func (c *Cos) CopyObject(ctx context.Context, src string, dst string) (*s3.CopyO
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cos) IsNotFound(err error) bool {
|
func (c *Cos) IsNotFound(err error) bool {
|
||||||
switch e := err.(type) {
|
switch e := errs.Unwrap(err).(type) {
|
||||||
case *cos.ErrorResponse:
|
case *cos.ErrorResponse:
|
||||||
return e.Response.StatusCode == http.StatusNotFound || e.Code == "NoSuchKey"
|
return e.Response.StatusCode == http.StatusNotFound || e.Code == "NoSuchKey"
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/OpenIMSDK/tools/errs"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -351,10 +352,7 @@ func (m *Minio) CopyObject(ctx context.Context, src string, dst string) (*s3.Cop
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Minio) IsNotFound(err error) bool {
|
func (m *Minio) IsNotFound(err error) bool {
|
||||||
if err == nil {
|
switch e := errs.Unwrap(err).(type) {
|
||||||
return false
|
|
||||||
}
|
|
||||||
switch e := err.(type) {
|
|
||||||
case minio.ErrorResponse:
|
case minio.ErrorResponse:
|
||||||
return e.StatusCode == http.StatusNotFound || e.Code == "NoSuchKey"
|
return e.StatusCode == http.StatusNotFound || e.Code == "NoSuchKey"
|
||||||
case *minio.ErrorResponse:
|
case *minio.ErrorResponse:
|
||||||
|
|||||||
@ -241,7 +241,7 @@ func (o *OSS) CopyObject(ctx context.Context, src string, dst string) (*s3.CopyO
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o *OSS) IsNotFound(err error) bool {
|
func (o *OSS) IsNotFound(err error) bool {
|
||||||
switch e := err.(type) {
|
switch e := errs.Unwrap(err).(type) {
|
||||||
case oss.ServiceError:
|
case oss.ServiceError:
|
||||||
return e.StatusCode == http.StatusNotFound || e.Code == "NoSuchKey"
|
return e.StatusCode == http.StatusNotFound || e.Code == "NoSuchKey"
|
||||||
case *oss.ServiceError:
|
case *oss.ServiceError:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user