Skip to content

Feat/pb 6335 file size limit validation#376

Open
AlexisMora wants to merge 6 commits into
mainfrom
feat/pb-6335-file-size-limit-validation
Open

Feat/pb 6335 file size limit validation#376
AlexisMora wants to merge 6 commits into
mainfrom
feat/pb-6335-file-size-limit-validation

Conversation

@AlexisMora
Copy link
Copy Markdown

@AlexisMora AlexisMora commented Jun 4, 2026

What is Changed / Added

This pull request implements upload file-size enforcement using per-file validation for uploads and backups.

For the upload into the virtual drive, the app now validates writes using the projected logical file size, calculated from the current temporal size, write offset, and incoming chunk length. This is needed because FUSE writes are chunk-based and may be sequential, sparse, or out of order. The app does not reliably know the source path or final source size upfront.

If the projected size exceeds the known user plan limit or the absolute 100GB upload cap, the write is rejected with EFBIG. The path is marked as blocked so later writes/releases for the same file do not continue uploading a partial temporal file. In this scenario, nautilus will also show a native modal stating that the given file is too big.

Added a mechanism for rejection aggegation to determine if the user is uploading a single or multiple files that have been rejected, so we know if we need to show the single or multiple file varian of the modal

Added backend 402 handling as FILE_TOO_BIG in create/override operations both in the virtual drive and backups FILE_TOO_BIG is treated as non-retryable.

Added fallback handling for the case where both api and local plan limit is not available. In that case, local validation still enforces the absolute 100GB cap, but plan-limit enforcement relies on the backend. If the backend rejects virtual-drive metadata creation/override with FILE_TOO_BIG, the temporal file is copied into a durable recovery folder while preserving the original virtual path structure:

  ~/.config/internxt/rejected-files-size-too-big/<original-virtual-path>
Example:

/photos/a/b/c/photo.jpg is recovered as: ~/.config/internxt/rejected-files-size-too-big/photos/a/b/c/photo.jpg

If the recovered path already exists, the file is saved as photo (copy 1).jpg, and later falls back to a timestamp/random suffix if needed.

For Backups the files that exceed the file size limit will just be skipped.

Why

The app needs to enforce upload size limits without losing user data during drag/drop, copy/paste, cut/paste, folder copies, backup uploads, and similar flows.

FUSE does not provide a reliable “this folder/file is about to be uploaded with this source path and final size” event. The reliable point for local virtual-drive enforcement is during write, using the projected resulting file size.

The preservation of the data is a priority in this case specially when relying on backend validation, even though nautilus by default does not "remove" origin even when cut or drag and drop on folders (thats not the case for files) I have decided to preserve the data locally in a separate file so the files that tried to be uploaded are still recoverable in the case that nautilus ever changes this behaviour.

@AlexisMora AlexisMora changed the base branch from main to feat/pb-6335-frontend-pre-validation-limits June 4, 2026 15:56
@AlexisMora AlexisMora added the enhancement New feature or request label Jun 4, 2026
@AlexisMora AlexisMora requested a review from egalvis27 June 4, 2026 16:18
@AlexisMora AlexisMora self-assigned this Jun 4, 2026
Base automatically changed from feat/pb-6335-frontend-pre-validation-limits to main June 5, 2026 08:39
Comment on lines +23 to +24
vi.restoreAllMocks();
vi.clearAllMocks();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remember, you don't need to do this. It's already done automatically.


beforeEach(() => {
vi.restoreAllMocks();
vi.clearAllMocks();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remember, you don't need to do this. It's already done automatically.

const stopWatching = vi.fn();

beforeEach(() => {
vi.resetAllMocks();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remember, you don't need to do this. It's already done automatically.


afterEach(() => {
clearMaxFileSizeRejectionModal();
vi.clearAllMocks();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remember, you don't need to do this. It's already done automatically.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 5, 2026

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants