Merge pull request #1625 from Budibase/octet-stream-issue

set content type on client lib upload
This commit is contained in:
Martin McKeaveney 2021-06-04 10:06:15 +01:00 committed by GitHub
commit 0002179931
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",
})
} }