🛂 (fileUpload) Improve file upload size limit enforcement

Closes #799, closes #797
This commit is contained in:
Baptiste Arnaud
2023-09-19 15:42:33 +02:00
parent f626c9867c
commit bb13c2bd61
19 changed files with 143 additions and 239 deletions

View File

@@ -1,8 +1,8 @@
import { FormLabel, HStack, Stack, Text } from '@chakra-ui/react'
import { FormLabel, Stack } from '@chakra-ui/react'
import { CodeEditor } from '@/components/inputs/CodeEditor'
import { FileInputOptions, Variable } from '@typebot.io/schemas'
import React from 'react'
import { TextInput, NumberInput } from '@/components/inputs'
import { TextInput } from '@/components/inputs'
import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'
@@ -24,9 +24,6 @@ export const FileInputSettings = ({ options, onOptionsChange }: Props) => {
const handleVariableChange = (variable?: Variable) =>
onOptionsChange({ ...options, variableId: variable?.id })
const handleSizeLimitChange = (sizeLimit?: number) =>
onOptionsChange({ ...options, sizeLimit })
const handleRequiredChange = (isRequired: boolean) =>
onOptionsChange({ ...options, isRequired })
@@ -48,16 +45,6 @@ export const FileInputSettings = ({ options, onOptionsChange }: Props) => {
initialValue={options.isMultipleAllowed}
onCheckChange={handleMultipleFilesChange}
/>
<HStack>
<NumberInput
label={'Size limit:'}
defaultValue={options.sizeLimit ?? 10}
onValueChange={handleSizeLimitChange}
withVariableButton={false}
/>
<Text>MB</Text>
</HStack>
<Stack>
<FormLabel mb="0">Placeholder:</FormLabel>
<CodeEditor