File tree Expand file tree Collapse file tree
apps/sim/lib/uploads/providers/s3 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -247,7 +247,7 @@ describe('S3 Client', () => {
247247 } )
248248
249249 describe ( 'staged upload primitives' , ( ) => {
250- it ( 'signs a fixed-size PUT with canonical object metadata ' , async ( ) => {
250+ it ( 'signs metadata without returning duplicate x-amz-meta headers ' , async ( ) => {
251251 mockGetSignedUrl . mockResolvedValueOnce ( 'https://example.com/signed-put' )
252252
253253 const result = await getS3PresignedUploadUrl ( {
@@ -270,8 +270,6 @@ describe('S3 Client', () => {
270270 url : 'https://example.com/signed-put' ,
271271 headers : {
272272 'Content-Type' : 'application/octet-stream' ,
273- 'x-amz-meta-uploadid' : 'upload-1' ,
274- 'x-amz-meta-purpose' : 'workspace_file' ,
275273 } ,
276274 } )
277275 } )
Original file line number Diff line number Diff line change @@ -170,7 +170,9 @@ export async function getPresignedUrlWithConfig(
170170
171171/**
172172 * Generates a signed single-object PUT for a caller-selected staging key.
173- * Every returned header covered by the signature must be sent verbatim by the client.
173+ * The AWS presigner hoists `x-amz-meta-*` values into the signed query string,
174+ * so only ordinary transfer headers are returned. Repeating that metadata as
175+ * request headers makes S3 reject the otherwise-valid signature.
174176 */
175177export async function getS3PresignedUploadUrl ( params : {
176178 key : string
@@ -193,9 +195,6 @@ export async function getS3PresignedUploadUrl(params: {
193195 url,
194196 headers : {
195197 'Content-Type' : params . contentType ,
196- ...Object . fromEntries (
197- Object . entries ( metadata ) . map ( ( [ key , value ] ) => [ `x-amz-meta-${ key . toLowerCase ( ) } ` , value ] )
198- ) ,
199198 } ,
200199 }
201200}
You can’t perform that action at this time.
0 commit comments