File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,21 @@ use aws_config::BehaviorVersion;
44use aws_sdk_s3:: Client ;
55use globset:: { Glob , GlobSet , GlobSetBuilder } ;
66use std:: sync:: Arc ;
7+ use urlencoding;
78
89use crate :: base:: field_attrs;
910use crate :: ops:: sdk:: * ;
1011
12+ /// Decode a form-encoded URL string, treating '+' as spaces
13+ fn decode_form_encoded_url ( input : & str ) -> Result < Arc < str > > {
14+ // Replace '+' with spaces (form encoding convention), then decode
15+ // This handles both cases correctly:
16+ // - Literal '+' would be encoded as '%2B' and remain unchanged after replacement
17+ // - Space would be encoded as '+' and become ' ' after replacement
18+ let with_spaces = input. replace ( "+" , " " ) ;
19+ Ok ( urlencoding:: decode ( & with_spaces) ?. into ( ) )
20+ }
21+
1122#[ derive( Debug , Deserialize ) ]
1223pub struct Spec {
1324 bucket_name : String ,
@@ -258,8 +269,9 @@ impl Executor {
258269 if record. event_name . starts_with ( "ObjectCreated:" )
259270 || record. event_name . starts_with ( "ObjectRemoved:" )
260271 {
272+ let decoded_key = decode_form_encoded_url ( & s3. object . key ) ?;
261273 changes. push ( SourceChange {
262- key : KeyValue :: Str ( s3 . object . key . into ( ) ) ,
274+ key : KeyValue :: Str ( decoded_key ) ,
263275 data : None ,
264276 } ) ;
265277 }
You can’t perform that action at this time.
0 commit comments