Repository navigation
Fix two clipboard bugs: echoed rich copies, local Office copies sent as pictures - #35
Merged
Merged
Conversation
A copy with markup (Excel cells, Word or web text) reaches the browser as markup plus text. The client later reads its clipboard back (on window focus in Chromium, and on Ctrl+V) and sends it as a new copy: it fingerprints the text it received but the markup-and-text bundle it sends, so the two never match, and the server wrote every incoming copy. The browser's sanitized markup then replaced the copying app's own formats -- Excel pasted values instead of cells and formulas -- and cancelled the copy in that app. The server now skips an incoming copy whose plain text matches what the session clipboard already holds. Images are always written. Local Office copies also reached the session as a picture: Chromium exposes the picture Office adds beside the text as image/png, and both the clipboard read and the paste handler took any image first. A copy with real text now goes as text; picture-only copies still go as images. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Two clipboard bugs found while reviewing the copy/paste paths.
1. The browser hands the session's own copy back over it (server patches 4–5)
A copy with markup (Excel cells, Word/Outlook/web text) reaches the browser as HTML plus text. The client later reads its local clipboard back and sends it as a new copy — on every window focus in Chromium, and on Ctrl+V via our read-on-keydown patch. Its echo check fingerprints only the text it received, but the HTML+text bundle it sends, so they never match; the server has no echo check for incoming writes either.
Result: the browser's sanitized HTML replaced Windows' clipboard. Pasting in the remote Excel gave values instead of cells/formulas, and Excel's copy was cancelled.
Fix:
write_clipboardskips an incoming copy whose plain text (CRLF and trailing whitespace normalized) matches what the session clipboard already holds. Images are always written (browsers re-encode them; the client has its own check).2. Local Office copies reached the session as a picture (client patches 8–9)
Chromium exposes the picture Office adds beside copied cells/text as
image/png, and both the clipboard read (rt) and the paste handler (te) took any image first — the client-side mirror of #34. A copy with non-blank text now goes as text/markup; picture-only copies still go as images.Testing
pytest: 223 passed, 3 skipped. The stand-ins now carry Selkies' realrt(),te()and envelope helpers verbatim; new tests cover the echo (rich and plain), new local copies, images, brace-leading text, Office copies via read and paste, and picture-only copies. The new tests fail without the patches.input_handler.pyandselkies-core.jsfrom the deployed container: the server file compiles, the bundle parses (node --check).🤖 Generated with Claude Code