[Bug] Clipboard fallback reports success even when copying fails

Đang mở
#384 3 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@srikar-naidu đang làm issue này rồi.

Từ ngày 31/10/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

bug

Describe the bug

The copy actions show a success message even when copying fails. If the modern Clipboard API is unavailable or rejects the request, the fallback uses document.execCommand('copy') but does not verify whether the command succeeded.

To Reproduce

  1. Open the OG image editor.
  2. Block clipboard permissions or use a browser where clipboard access is unavailable.
  3. Click Copy Image URL or Copy Meta Tags.
  4. Observe the notification.

Expected behavior

The app should show a success message only when the content is actually copied. If both copy methods fail, it should display an error message.

Actual behavior

The app shows “URL copied to clipboard!” or “Meta tags copied!” even when the fallback copy operation fails.

Screenshots

Not applicable. A screenshot of the misleading success notification may be added if available.

Environment

  • Browser: Chrome
  • OS: Windows 11
  • Node version: 22.x
  • npm version: 10.x
  • URL: Local OG image editor

Additional context

The fallback currently performs the copy without checking the result:

document.execCommand('copy');
document.body.removeChild(ta);
setCopied(label);
window.showToast?.('URL copied to clipboard!', 'success');

document.execCommand('copy') returns a boolean. The result should be checked, and an error notification should be shown when it returns false or throws.

Ngôn ngữ chính
TypeScript
Star
8
Fork
4
Merge trung bình
8 giờ 47 phút
Pull request đã merge (30 ngày)
157

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của codercops/ogcops

Tất cả issue của codercops/ogcops

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.