Don't send S3 image data url to rows endpoint
This commit is contained in:
parent
d1d3dd3c37
commit
139c642199
|
@ -2,6 +2,7 @@
|
|||
import Field from "./Field.svelte"
|
||||
import { CoreDropzone, ProgressCircle } from "@budibase/bbui"
|
||||
import { getContext, onMount, onDestroy } from "svelte"
|
||||
import { cloneDeep } from "../../../../../bbui/src/helpers"
|
||||
|
||||
export let datasourceId
|
||||
export let bucket
|
||||
|
@ -14,6 +15,7 @@
|
|||
|
||||
let fieldState
|
||||
let fieldApi
|
||||
let localFiles = []
|
||||
|
||||
const { API, notificationStore, uploadStore } = getContext("sdk")
|
||||
const component = getContext("component")
|
||||
|
@ -90,9 +92,17 @@
|
|||
}
|
||||
|
||||
const handleChange = e => {
|
||||
const changed = fieldApi.setValue(e.detail)
|
||||
localFiles = e.detail
|
||||
let files = cloneDeep(e.detail) || []
|
||||
// remove URL as it contains the full base64 image data
|
||||
files.forEach(file => {
|
||||
if (file.type?.startsWith("image")) {
|
||||
delete file.url
|
||||
}
|
||||
})
|
||||
const changed = fieldApi.setValue(files)
|
||||
if (onChange && changed) {
|
||||
onChange({ value: e.detail })
|
||||
onChange({ value: files })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,7 +128,7 @@
|
|||
<div class="content">
|
||||
{#if fieldState}
|
||||
<CoreDropzone
|
||||
value={fieldState.value}
|
||||
value={localFiles}
|
||||
disabled={loading || fieldState.disabled}
|
||||
error={fieldState.error}
|
||||
on:change={handleChange}
|
||||
|
|
Loading…
Reference in New Issue