Skip to content

fix(kimi-web): ignore non-string markdown copy payloads - #1922

Closed
arimu1 wants to merge 1 commit into
MoonshotAI:mainfrom
arimu1:fix/1812-copy-clipboard-event
Closed

fix(kimi-web): ignore non-string markdown copy payloads#1922
arimu1 wants to merge 1 commit into
MoonshotAI:mainfrom
arimu1:fix/1812-copy-clipboard-event

Conversation

@arimu1

@arimu1 arimu1 commented Jul 19, 2026

Copy link
Copy Markdown

Related Issue

Resolve #1812

Problem

See linked issue. Copying a code block in kimi web could put the literal string [object ClipboardEvent] on the clipboard.

What changed

  • Added asCopyableText() to accept only non-empty string copy payloads
  • Markdown.vue copyCodeBlockFallback now ignores non-string @copy payloads (for example a native ClipboardEvent) before the HTTP clipboard fallback runs
  • Unit tests for asCopyableText
  • Patch changeset for the CLI bundle that ships the web UI

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Made with Cursor

Markstream @copy can deliver a native ClipboardEvent. Coercing that
object wrote the literal "[object ClipboardEvent]" to the clipboard.
Only fall back when the payload is a non-empty string.

Resolve MoonshotAI#1812

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot

changeset-bot Bot commented Jul 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 53fac0e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@arimu1

arimu1 commented Jul 25, 2026

Copy link
Copy Markdown
Author

Closing this — the fix landed independently in #2120.

copyCodeBlockFallback now lives in apps/kimi-web/src/lib/clipboard.ts on main and opens with exactly the guard this PR was adding:

export function copyCodeBlockFallback(payload: unknown): void {
  if (typeof payload !== 'string') return;
  ...
}

with test/clipboard.test.ts covering it via { toString: () => '[object ClipboardEvent]' }. That's the whole substance of this PR, so rebasing would leave only a cosmetic difference. Thanks for the look regardless.

@arimu1 arimu1 closed this Jul 25, 2026
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.

kimi web版本复制出现 [object ClipboardEvent] 这个,似乎是复制有问题

1 participant