Skip to content

Commit

Permalink
Fix filename extension not correctly set in some browser
Browse files Browse the repository at this point in the history
  • Loading branch information
yunusefendi52 committed Dec 8, 2024
1 parent 4dd9ef5 commit 5c07051
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/api/artifacts/download-artifact.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const getArtifactFromInternal = async (
const { assets } = getStorageKeys(app.organizationsId!, app.id, actuallyHasApk ? detailArtifact.fileObjectApkKey! : detailArtifact.fileObjectKey)
const s3 = new S3Fetch()
const artifactExt = actuallyHasApk ? 'apk' : detailArtifact.extension
const signedUrl = await s3.getSignedUrlGetObject(assets, 1800, `attachment; filename ="${app.name}${artifactExt ? `.${artifactExt}` : ''}"`)
const signedUrl = await s3.getSignedUrlGetObject(assets, 1800, `attachment; filename="${encodeURIComponent(app.name)}${artifactExt ? `.${artifactExt}` : ''}"`)
return {
signedUrl,
userOrg: org,
Expand Down
2 changes: 1 addition & 1 deletion server/services/s3fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class S3Fetch {

async getSignedUrlGetObject(key: string, expiresIn: number, contentDisposition: string): Promise<string> {
const { client, S3_ENDPOINT } = createAwsClient()
const signedUrl = await client.sign(`${S3_ENDPOINT}/${s3BucketName}/${key}?X-Amz-Expires=${expiresIn}&response-content-disposition=${contentDisposition}`, {
const signedUrl = await client.sign(`${S3_ENDPOINT}/${s3BucketName}/${key}?X-Amz-Expires=${expiresIn}&response-content-disposition=${contentDisposition}&response-content-type=application/octet-stream`, {
aws: {
signQuery: true,
},
Expand Down

0 comments on commit 5c07051

Please sign in to comment.