1
0
Fork 0
mirror of synced 2024-07-03 05:20:32 +12:00

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

View file

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

View file

@ -30,5 +30,7 @@ exports.uploadClientLibrary = async appId => {
const sourcepath = require.resolve("@budibase/client") const sourcepath = require.resolve("@budibase/client")
const destPath = join(appId, "budibase-client.js") 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",
})
} }