Просмотр исходного кода

Return 404 for missing GCS objects (#1576)

* fix(gcs): correctly detect wrapped not-found errors using errors.Is

* refactor(gcs): simplify error handling logic with guard clause
Carson Brown 3 месяцев назад
Родитель
Сommit
8a62a87978
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      transport/gcs/gcs.go

+ 1 - 1
transport/gcs/gcs.go

@@ -187,7 +187,7 @@ func (t transport) RoundTrip(req *http.Request) (*http.Response, error) {
 }
 
 func handleError(req *http.Request, err error) (*http.Response, error) {
-	if err != storage.ErrBucketNotExist && err != storage.ErrObjectNotExist {
+	if !errors.Is(err, storage.ErrBucketNotExist) && !errors.Is(err, storage.ErrObjectNotExist) {
 		return nil, err
 	}