Skip to content

Commit ec85bc0

Browse files
committed
fix: show correct max file size in CSV import dialog
The file picker was showing a hardcoded "10MB" limit which didn't reflect the actual upload limit. Now reads the plan-based fileSize limit on cloud and displays it dynamically using humanFileSize(). On self-hosted the size hint is hidden since the limit depends on server configuration.
1 parent bb1b797 commit ec85bc0

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

src/lib/components/filePicker.svelte

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import { Button, InputSelect } from '$lib/elements/forms';
1010
import DualTimeView from './dualTimeView.svelte';
1111
import type { Models } from '@appwrite.io/console';
12-
import { calculateSize } from '$lib/helpers/sizeConvertion';
12+
import { calculateSize, humanFileSize, sizeToBytes } from '$lib/helpers/sizeConvertion';
1313
import InputSearch from '$lib/elements/forms/inputSearch.svelte';
1414
import { ID, Query, Permission, Role } from '@appwrite.io/console';
1515
import {
@@ -34,6 +34,8 @@
3434
import { showCreateBucket } from '$routes/(console)/project-[region]-[project]/storage/+page.svelte';
3535
import { preferences } from '$lib/stores/preferences';
3636
import { addNotification } from '$lib/stores/notifications';
37+
import { isCloud } from '$lib/system';
38+
import { currentPlan } from '$lib/stores/organization';
3739
3840
export let show: boolean;
3941
export let mimeTypeQuery: string = 'image/';
@@ -53,6 +55,10 @@
5355
let fileSelector: HTMLInputElement;
5456
let uploading = false;
5557
let view: 'grid' | 'list' = 'list';
58+
$: planMaxSize =
59+
isCloud && $currentPlan?.['fileSize']
60+
? sizeToBytes($currentPlan['fileSize'], 'MB', 1000)
61+
: null;
5662
5763
onMount(() => {
5864
const lastSelectedBucket = preferences.getKey('lastSelectedBucket', null);
@@ -381,8 +387,12 @@
381387
: `${allowedExtension} files are allowed`}</svelte:fragment>
382388
</Tooltip>
383389
</Layout.Stack>
384-
<Typography.Caption variant="400"
385-
>Max file size: 10MB</Typography.Caption>
390+
{#if planMaxSize}
391+
{@const readableMaxSize = humanFileSize(planMaxSize)}
392+
<Typography.Caption variant="400"
393+
>Max file size: {readableMaxSize.value +
394+
readableMaxSize.unit}</Typography.Caption>
395+
{/if}
386396
</Layout.Stack>
387397
</Layout.Stack>
388398
</Upload.Dropzone>

0 commit comments

Comments
 (0)