Hi there, I’m looking around to know how does active storage creates the service URL of any uploaded document to S3. I tried the guide by AWS Authenticating Requests: Using Query Parameters (AWS Signature Version 4) - Amazon Simple Storage Service It’s working fine but the uploaded file by active is extensionless and downloads the same file(i.e extensionless) but the link generated by active storage downloads with the correct file name.
Ex: File URL by Active Storage:
https://xyz.s3.ap-south-1.amazonaws.com/tg6AbybBgFMidmKy5dz4vVXZ?response-content-disposition=attachment; filename="uploaded_file.xlsx"; filename*=UTF-8''uploaded_file.xlsx&response-content-type=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AAAAAAAAAAAAAAAAAAKEY/20201212/ap-south-1/s3/aws4_request&X-Amz-Date=20201212T112434Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=7fab73360c28b3f7f7d4e6d6893a2b91aa183c703ac890898e55845de44d917c
The one I generated using the above-mentioned URL which downloads the file but without extension and with the key instead of the actual name:
https://xyz.s3.ap-south-1.amazonaws.com/tg6AbybBgFMidmKy5dz4vVXZ?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AAAAAAAAAAAAAAAAAAKE%2F20201226%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20201226T174805Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=a542ca7e18492882d0dca527e9521fa5325c1d88650728cd44ea4bf26fd2a1b0
It looked to me that adding this in a string to sign might solve the problem but it didn’t. I looked around and got to know that it’s used to override response headers but I’m still looking for the correct way to generate the signature.
response-content-disposition=attachment; filename="uploaded_file.xlsx"; filename*=UTF-8''uploaded_file.xlsx&response-content-type=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
may anyone help me with the signature key logic around this, please?