set content type on client lib upload

This commit is contained in:
Martin McKeaveney 2021-06-03 21:33:44 +01:00
parent 01bd6f40bc
commit ca6735a11a
3 changed files with 7 additions and 5 deletions

View File

@ -159,7 +159,7 @@ exports.upload = async ({
* Similar to the upload function but can be used to send a file stream
* through to the object store.
*/
exports.streamUpload = async (bucketName, filename, stream) => {
exports.streamUpload = async (bucketName, filename, stream, extra = {}) => {
const objectStore = exports.ObjectStore(bucketName)
await exports.makeSureBucketExists(objectStore, bucketName)
@ -167,6 +167,7 @@ exports.streamUpload = async (bucketName, filename, stream) => {
Bucket: sanitizeBucket(bucketName),
Key: sanitizeKey(filename),
Body: stream,
...extra,
}
return objectStore.upload(params).promise()
}

View File

@ -31,7 +31,6 @@
margin: 0;
padding: 0;
}
*,
*:before,
*:after {
@ -41,9 +40,9 @@
</svelte:head>
<body id="app">
<script src={clientLibPath}>
<script type="application/javascript" src={clientLibPath}>
</script>
<script>
<script type="application/javascript">
loadBudibase()
</script>
</body>

View File

@ -30,5 +30,7 @@ exports.uploadClientLibrary = async appId => {
const sourcepath = require.resolve("@budibase/client")
const destPath = join(appId, "budibase-client.js")
await streamUpload(BUCKET_NAME, destPath, fs.createReadStream(sourcepath))
await streamUpload(BUCKET_NAME, destPath, fs.createReadStream(sourcepath), {
ContentType: "application/javascript",
})
}