diff --git a/packages/bbui/src/Form/Core/Dropzone.svelte b/packages/bbui/src/Form/Core/Dropzone.svelte index bbaf5a3ff9..01b63be1bc 100644 --- a/packages/bbui/src/Form/Core/Dropzone.svelte +++ b/packages/bbui/src/Form/Core/Dropzone.svelte @@ -146,7 +146,9 @@ preview {:else}
-
{selectedImage.extension}
+
+ {selectedImage.name || "Unknown file"} +
Preview not supported
{/if} @@ -357,18 +359,21 @@ white-space: nowrap; width: 0; margin-right: 10px; + user-select: all; } .placeholder { display: flex; flex-direction: column; justify-content: center; align-items: center; + text-align: center; } .extension { color: var(--spectrum-global-color-gray-600); text-transform: uppercase; font-weight: 600; margin-bottom: 5px; + user-select: all; } .nav { diff --git a/packages/client/src/api/attachments.js b/packages/client/src/api/attachments.js index 9bb5aa0a49..6e97bbd956 100644 --- a/packages/client/src/api/attachments.js +++ b/packages/client/src/api/attachments.js @@ -11,7 +11,25 @@ export const uploadAttachment = async (data, tableId = "") => { }) } -export const uploadToS3 = async (signedUrl, data) => { +/** + * Generates a signed URL to upload a file to an external datasource. + */ +export const getSignedDatasourceURL = async (datasourceId, bucket, key) => { + if (!datasourceId) { + return null + } + const res = await API.post({ + url: `/api/attachments/${datasourceId}/url`, + body: { bucket, key }, + }) + return res?.signedUrl +} + +/** + * Uploads a file to an external datasource. + */ +export const externalUpload = async (datasourceId, bucket, key, data) => { + const signedUrl = await getSignedDatasourceURL(datasourceId, bucket, key) await API.put({ url: signedUrl, body: data, diff --git a/packages/client/src/components/app/forms/S3Upload.svelte b/packages/client/src/components/app/forms/S3Upload.svelte index 1f2d308e66..62f154657e 100644 --- a/packages/client/src/components/app/forms/S3Upload.svelte +++ b/packages/client/src/components/app/forms/S3Upload.svelte @@ -1,8 +1,7 @@