Attach correct content type to JS files when uploading to object store

This commit is contained in:
Andrew Kingston 2022-08-11 15:25:04 +01:00
parent f2ee01d58f
commit a38373a939
1 changed files with 8 additions and 0 deletions

View File

@ -178,6 +178,14 @@ export const streamUpload = async (
const objectStore = ObjectStore(bucketName)
await makeSureBucketExists(objectStore, bucketName)
// Set content type for certain known extensions
if (filename?.endsWith(".js")) {
extra = {
...extra,
ContentType: "application/javascript",
}
}
const params = {
Bucket: sanitizeBucket(bucketName),
Key: sanitizeKey(filename),