[Bug] Clipboard fallback reports success even when copying fails

Aberta
#384 3 comentários 0 reações 1 responsável Ver no GitHub

Mantenedores costumam responder em até 1 dia

@srikar-naidu já está trabalhando nisso.

Desde 31/10/2026.

Avaliação

Esta issue ainda não foi avaliada.

Descrição

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.

Linguagem predominante
TypeScript
Estrelas
8
Forks
4
Merge médio
8h 44min
PRs com merge (30d)
158

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de codercops/ogcops

Todas as issues de codercops/ogcops

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.