Skip to content

🐛 Bugfix: Fix inability to copy content to clipboard in http#3292

Merged
WMC001 merged 1 commit into
developfrom
xyq/bugfix_clipboard
Jun 24, 2026
Merged

🐛 Bugfix: Fix inability to copy content to clipboard in http#3292
WMC001 merged 1 commit into
developfrom
xyq/bugfix_clipboard

Conversation

@xuyaqist

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings June 24, 2026 03:02
@xuyaqist xuyaqist requested review from Dallas98 and WMC001 as code owners June 24, 2026 03:02
@xuyaqist xuyaqist changed the title Bugfix: Fix inability to copy content to clipboard in http 🐛 Bugfix: Fix inability to copy content to clipboard in http Jun 24, 2026

Copilot AI left a comment

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.

Pull request overview

Fixes clipboard copy behavior in contexts where the modern Clipboard API is unavailable or blocked (e.g., non-secure HTTP origins) by switching the access-key copy action to a shared clipboard utility with a fallback mechanism.

Changes:

  • Replaced direct navigator.clipboard.writeText(...) usage with copyToClipboard(...) for copying the access key.
  • Added the copyToClipboard import to the user profile component.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@YehongPan

Copy link
Copy Markdown
Contributor

🔍 Code Review Comments

1. [代码规范] copyToClipboard fallback 确认
copyToClipboard 引入自 @/lib/clipboard,应确认该模块是否已有 fallback 到 document.execCommand('copy') 的实现,纯 navigator.clipboard 在非 HTTPS 环境下会抛异常。

2. [逻辑漏洞] 全局搜索遗漏
仅替换了 UserProfileComp.tsx 中的一处调用,但项目中可能还有其他直接使用 navigator.clipboard.writeText 的地方未修复,应全局搜索确认。

@YehongPan YehongPan left a comment

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.

Code Review

  • [代码规范] copyToClipboard 引入自 @/lib/clipboard,应确认该模块是否已有 fallback 到 document.execCommand('copy') 的实现,纯 navigator.clipboard 在非 HTTPS 环境下会抛异常。
  • [逻辑漏洞] 仅替换了 UserProfileComp.tsx 中的一处调用,但项目中可能还有其他直接使用 navigator.clipboard.writeText 的地方未修复,应全局搜索确认。

Comment thread frontend/app/[locale]/users/components/UserProfileComp.tsx
Comment thread frontend/app/[locale]/users/components/UserProfileComp.tsx
@WMC001 WMC001 merged commit 89039de into develop Jun 24, 2026
9 checks passed
@WMC001

WMC001 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

LGTM. Simple fix — replacing innerText with innerHTML in the copy handler is appropriate. No issues found.

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.

6 participants