Skip to content

Commit 61da69a

Browse files
committed
chore: add max size for favicon
1 parent 6562355 commit 61da69a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

apps/studio/src/features/editing-experience/components/form-builder/renderers/controls/JsonFormsImageControl.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ControlProps, RankedTester } from "@jsonforms/core"
1+
import type { ControlProps, JsonSchema, RankedTester } from "@jsonforms/core"
22
import { Box, FormControl } from "@chakra-ui/react"
33
import { and, isStringControl, rankWith, schemaMatches } from "@jsonforms/core"
44
import { withJsonFormsControlProps } from "@jsonforms/react"
@@ -24,6 +24,7 @@ export const jsonFormsImageControlTester: RankedTester = rankWith(
2424
)
2525
interface JsonFormsImageControlProps extends ControlProps {
2626
data: string
27+
schema: JsonSchema & { maxSizeInBytes?: number }
2728
}
2829
export function JsonFormsImageControl({
2930
label,
@@ -33,6 +34,7 @@ export function JsonFormsImageControl({
3334
errors,
3435
description,
3536
data,
37+
schema,
3638
}: JsonFormsImageControlProps) {
3739
const { siteId, pageId, linkId } = useQueryParse(pageOrLinkSchema)
3840

@@ -46,7 +48,7 @@ export function JsonFormsImageControl({
4648
/>
4749
) : (
4850
<FileAttachment
49-
maxSizeInBytes={MAX_IMG_FILE_SIZE_BYTES}
51+
maxSizeInBytes={schema.maxSizeInBytes ?? MAX_IMG_FILE_SIZE_BYTES}
5052
acceptedFileTypes={IMAGE_UPLOAD_ACCEPTED_MIME_TYPE_MAPPING}
5153
siteId={siteId}
5254
resourceId={(pageId ?? linkId) ? String(pageId ?? linkId) : undefined}

packages/components/src/types/site.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export const LogoSettingsSchema = Type.Object({
6969
description:
7070
"This appears on a browser tab to help people recognise your site. We recommend a minimum size of 24px by 24px, in .ico, .svg, or .png format.",
7171
format: "image",
72+
maxSizeInBytes: 50000, // NOTE: 50 kB
7273
}),
7374
),
7475
})

0 commit comments

Comments
 (0)