Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix double-decode on presigm param #185

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lambda-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const streamify_handler: StreamifyHandler = async ( event, response ) => {
// If there is a presign param, we need to decode it and add it to the args. This is to provide a secondary way to pass pre-sign params,
// as using them in a Lambda function URL invocation will trigger a Lambda error.
if ( args.presign ) {
const presignArgs = new URLSearchParams( decodeURIComponent( args.presign ) );
const presignArgs = new URLSearchParams( args.presign );
for ( const [ key, value ] of presignArgs.entries() ) {
args[ key as keyof Args ] = value;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test-private-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ test( 'Test get private upload with presign params', async () => {
'headers': {
},
'queryStringParameters': {
presign: encodeURIComponent( new URLSearchParams( presignParams ).toString() ),
presign: new URLSearchParams( presignParams ).toString(),
},
'isBase64Encoded': false,
};
Expand Down
Loading