[Bug] Clipboard fallback reports success even when copying fails

Offen
#384 3 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@srikar-naidu arbeitet bereits daran.

Seit 31.10.2026.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

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.

Vorherrschende Sprache
TypeScript
Sterne
8
Forks
4
Ø Merge
8 Std. 47 Min.
Gemergte PRs (30 T.)
157

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus codercops/ogcops

Alle Issues in codercops/ogcops

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.