Skip to content

fix: show correct max file size in CSV import dialog#2955

Open
premtsd-code wants to merge 2 commits intomainfrom
fix-csv-import-max-file-size
Open

fix: show correct max file size in CSV import dialog#2955
premtsd-code wants to merge 2 commits intomainfrom
fix-csv-import-max-file-size

Conversation

@premtsd-code
Copy link
Copy Markdown
Contributor

@premtsd-code premtsd-code commented Apr 2, 2026

Summary

  • The file picker's local file upload showed a hardcoded "Max file size: 10MB" which was incorrect
  • Now dynamically reads the plan-based fileSize limit on cloud and displays it using humanFileSize() (e.g. 50MB for Starter, 5GB for Pro/Scale)
  • Fix inconsistent dropzone text across all file upload components — standardized to "Drag and drop a file here or click to upload" (9 files)

Test plan

  • Open CSV import dialog on a Pro plan — should show "Max file size: 5GB"
  • Open CSV import dialog on a Starter plan — should show "Max file size: 50MB"
  • Verify dropzone text reads "Drag and drop a file here or click to upload" in: CSV import, storage file create, env variable import (project + function), site deploy, function deploy, domain record import

Starter Plan:
image

Pro Plan:
image

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.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 2, 2026

Greptile Summary

This PR replaces the hardcoded "Max file size: 10MB" label in filePicker.svelte's local-file upload dropzone with a dynamically computed value derived from the current billing plan's fileSize field (converted from MB to bytes via sizeToBytes, then formatted with humanFileSize). The approach is consistent with the same pattern already used in updateMaxFileSize.svelte. The remaining eight files receive a minor copy fix ("files" → "a file") in drag-and-drop labels.

  • planMaxSize correctly handles the cloud/self-hosted split: on self-hosted (isCloud === false) the caption is suppressed entirely; on cloud it reads $currentPlan['fileSize'] (a number in MB) and converts it with base-1000 arithmetic, matching existing billing helpers.
  • sizeToBytes(value, 'MB', 1000) conversion is correct and consistent with the updateMaxFileSize.svelte pattern (service * 1000 * 1000).
  • The caption is now hidden on self-hosted — this is a behaviour change from the old hardcoded 10 MB, and may be worth explicitly documenting as intentional since self-hosted has no plan-based limits.

Confidence Score: 5/5

Safe to merge — the core logic change is correct and consistent with existing billing helpers; the only open item is a minor UX consideration on self-hosted.

All remaining findings are P2. The dynamic size computation matches the established pattern in updateMaxFileSize.svelte. No data loss, security, or runtime-error risk.

src/lib/components/filePicker.svelte — only file with logic changes; all others are copy-only edits.

Important Files Changed

Filename Overview
src/lib/components/filePicker.svelte Core change: dynamically computes plan-based max file size for cloud, hides the caption entirely on self-hosted (previously hardcoded 10MB). Logic is consistent with existing usage in updateMaxFileSize.svelte.
src/lib/components/variables/importVariablesModal.svelte Copy fix only: "files" → "a file" in drag-and-drop label.
src/routes/(console)/project-[region]-[project]/storage/bucket-[bucket]/create/+page.svelte Copy fix only: "files" → "a file" in drag-and-drop label.
src/routes/(console)/project-[region]-[project]/uploadVariablesModal.svelte Copy fix only: "files" → "a file" in drag-and-drop label.

Reviews (2): Last reviewed commit: "fix: consistent dropzone text across all..." | Re-trigger Greptile

Comment on lines +393 to +394
>Max file size: {readableMaxSize.value +
readableMaxSize.unit}</Typography.Caption>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Missing space between value and unit

readableMaxSize.value + readableMaxSize.unit produces "50MB" or "5GB" with no space. The existing usage in updateMaxFileSize.svelte does the same thing (line 51: {Math.floor(parseInt(size.value))}{size.unit}), so this is consistent with the codebase convention. That said, the humanFileSize helper returns a space-separated pair from prettyBytes precisely to allow callers to format them separately — displaying "5 GB" is more readable and closer to the format prettyBytes produces internally. Consider adding a space:

Suggested change
>Max file size: {readableMaxSize.value +
readableMaxSize.unit}</Typography.Caption>
>Max file size: {readableMaxSize.value + ' ' +
readableMaxSize.unit}</Typography.Caption>

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant