-
Notifications
You must be signed in to change notification settings - Fork 353
Open
Labels
Description
Bug report:
download success: false, cost: 41 ms error: SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your Secret Access Key and signing method. Consult the service documentation for details.
Expected behavior:
Set range header when it is not empty. I have fixed the problem as follows:
diff --git a/pkg/source/clients/s3protocol/s3_source_client.go b/pkg/source/clients/s3protocol/s3_source_client.go
index 5dea03ed..acb2e1e7 100644
--- a/pkg/source/clients/s3protocol/s3_source_client.go
+++ b/pkg/source/clients/s3protocol/s3_source_client.go
@@ -132,14 +132,15 @@ func (s *s3SourceClient) Download(request *source.Request) (*source.Response, er
return nil, err
}
- resp, err := client.GetObjectWithContext(request.Context(),
- &s3.GetObjectInput{
- Bucket: aws.String(request.URL.Host),
- Key: aws.String(request.URL.Path),
- // TODO more header pass to GetObjectInput
- Range: aws.String(request.Header.Get(headers.Range)),
- })
-
+ req := &s3.GetObjectInput{
+ Bucket: aws.String(request.URL.Host),
+ Key: aws.String(request.URL.Path),
+ }
+ if rangeHeader := request.Header.Get(headers.Range); rangeHeader != "" {
+ req.Range = aws.String(rangeHeader)
+ }
+ // TODO more header pass to GetObjectInput
+ resp, err := client.GetObjectWithContext(request.Context(), req)How to reproduce it:
Environment:
- Dragonfly version: main
- OS: centos4u3
- Kernel (e.g.
uname -a): 4.14 - Others: