✨ discard oversized non-file paste items to prevent huge database rows - #4699
Merged
guiyanakuang merged 4 commits intoJul 31, 2026
Merged
Conversation
…rten its subtitle
guiyanakuang
deleted the
feat/issue-4698-discard-oversized-non-file-paste
branch
July 31, 2026 06:59
This was referenced Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4698
Summary
Adds a write-side defense against oversized paste rows (root cause of a mobile production crash: single rows >10MB hitting Android's CursorWindow limit). The limit applies only to non-file carrier types — text / HTML / RTF / URL / color; files and images are exempt and remain governed by
maxSyncFileSize.The limit is always on — there is no enable/disable toggle. It is a robustness defense, not a preference; the escape hatch for users who intentionally copy huge text is raising the MB value. Note the receive-side check always runs with the receiving device's own config, so one device raising its limit never weakens another device's protection.
Changes
Config (
sharedcommonMain + desktop/e2e/cli implementations)maxNonFilePasteSize: Long(MB, default8), styled aftermaxSyncFileSize. Legacy configs without the field deserialize to the default. No enable flag — the limit cannot be turned off.Local write path (
DiscardOversizedNonFilePlugin, commonMain)RemoveInvalidPlugin.non_file_paste_discarded_too_large); the resulting empty list makesPasteReleaseServicemark-delete the row via the existing path.Remote receive path (
PasteReleaseService.releaseRemotePasteData)remote_non_file_paste_discarded_too_large).PasteData's hash/pasteType/searchContent are already assembled, and flavor degradation would break the hash-content consistency that same-hash dedup relies on. The sender keeps the full data, so nothing is lost.releaseRemotePasteDataForPush(file-only path) is intentionally unchanged.Settings UI
max_back_up_file_size— the limit governs local recording, so it lives with the other recording controls rather than in network settings. The item subtitle spells out the affected types and the file/image exemption.i18n
max_non_file_paste_size,max_non_file_paste_size_desc,non_file_paste_discarded_too_large,remote_non_file_paste_discarded_too_large) across all 10 language files.Tests
DiscardOversizedNonFilePluginTest: all-oversized → empty + notification; partial → silent degradation; raised limit retains items; file/image exempt; empty input; exact-at-limit retained.PasteReleaseServiceRemoteDiscardTest: oversized remote paste skipped with notification; within-limit and raised-limit paths release normally.DesktopAppConfigTest.app:desktopTestsuite passes;e2eandclicompile.Notes
PasteItem.sizeis pre-maintained and not recomputed.