check errors

This commit is contained in:
chrislu
2025-11-21 14:48:41 -08:00
parent f125a013a8
commit 99a9a67741
3 changed files with 51 additions and 11 deletions

View File

@@ -2,12 +2,14 @@ package s3api
import (
"context"
"errors"
"fmt"
"net/http"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
"github.com/seaweedfs/seaweedfs/weed/s3api/s3err"
weed_server "github.com/seaweedfs/seaweedfs/weed/server"
)
// executeUnifiedCopyStrategy executes the appropriate copy strategy based on encryption state
@@ -76,6 +78,14 @@ func (s3a *S3ApiServer) mapCopyErrorToS3Error(err error) s3err.ErrorCode {
return s3err.ErrNone
}
// Check for read-only errors (quota enforcement)
// Uses errors.Is() to properly detect wrapped errors
if errors.Is(err, weed_server.ErrReadOnly) {
// Bucket is read-only due to quota enforcement or other configuration
// Return 403 Forbidden per S3 semantics (similar to MinIO's quota enforcement)
return s3err.ErrAccessDenied
}
// Check for KMS errors first
if kmsErr := MapKMSErrorToS3Error(err); kmsErr != s3err.ErrInvalidRequest {
return kmsErr