eVolve
eVolve

Reputation: 1446

Adding Content-Disposition after an AWS presigned url have been generated

As Presigned url suggests it is a signed url that can be validated using the signature. I am able to set the Content-Disposition header on the ResponseHeaderOverrides in order to change the filename when downloading the file using the persigned url.

            GetPreSignedUrlRequest request = new GetPreSignedUrlRequest
            {
                BucketName = bucketName,
                Key = objectKey,
                Expires = DateTime.UtcNow.AddMinutes(duration),
                ResponseHeaderOverrides = new ResponseHeaderOverrides { ContentDisposition =$"attachment; filename=\"MyNewFileName.doc\""}
            };

Is it possible to generate the presigned url and then when using that url use a Content-Disposition header or query param in order to ensure a file downloads with a certain name. Currently the desired file name is not known at the time when the presigned url is generated.

Upvotes: 1

Views: 2375

Answers (1)

jellycsc
jellycsc

Reputation: 12259

No, this is not possible since the specified header is included in the String to Sign.

Upvotes: 2

Related Questions