Skip to content

Commit

Permalink
TC-1817 collector - SQS: unescape AWS S3 Key
Browse files Browse the repository at this point in the history
Signed-off-by: mrizzi <[email protected]>
  • Loading branch information
mrizzi committed Dec 19, 2024
1 parent 79346b2 commit c92afce
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/handler/collector/s3/messaging/sqs.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"context"
"encoding/json"
"fmt"
"net/url"
"strings"

"github.com/aws/aws-sdk-go-v2/aws"
Expand Down Expand Up @@ -81,7 +82,12 @@ func (m *SqsMessage) GetItem() (string, error) {
if len(m.Records) == 0 {
return "", fmt.Errorf("error getting item from message %s", m)
}
return m.Records[0].S3.Object.Key, nil
// https://issues.redhat.com/browse/TC-1817 requires the key to be unescaped
unescapedKey, err := url.QueryUnescape(m.Records[0].S3.Object.Key)
if err != nil {
return "", fmt.Errorf("error getting decoded item from message %s due to %s", m, err)
}
return unescapedKey, nil
}

func NewSqsProvider(mpConfig MessageProviderConfig) (SqsProvider, error) {
Expand Down

0 comments on commit c92afce

Please sign in to comment.