Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Base64: pasting text like `password123` switches to Decode and shows an error

Aperta Adatta ai principianti
#219 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
92/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
nextjs, typescript
Ambito
frontend

Direzione di ricerca

Inizia da lib/base64-utils.ts, in particolare decodeText e detectBase64, quindi esamina handlePaste in app/(tools)/base64/components/TextTab.tsx. Aggiungi o aggiorna i test in lib/__tests__/base64-utils.test.ts per coprire i falsi positivi elencati e il testo Base64 valido, quindi verifica con npm run lint, npm run test e npm run build.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug good first issue hacktoberfest

On the Base64 tool's Text tab, in Encode mode, paste password123. The tool shows the "Looks like base64" notice, switches to Decode, and the output is "Decoded successfully but result is not valid UTF-8 text." instead of cGFzc3dvcmQxMjM=. The same happens with hello-world, 2024-01-15 and user_id_123.

detectBase64 (lib/base64-utils.ts, line 65) says yes to anything that's at least 8 characters of the base64 alphabet with one digit, +, /, =, _ or - in it (line 74), and atob happily decodes all four of these. The paste handler switches to Decode whenever it says yes (app/(tools)/base64/components/TextTab.tsx, line 104). The existing tests already reject plain words like password (lib/__tests__/base64-utils.test.ts, line 97), so these are the same kind of false positive.

What to do

  • Only switch to Decode on paste when the pasted text also decodes to valid UTF-8 text (decodeText in the same file returns ok: true).
  • Real base64 of text, like SGVsbG8= or aGVsbG8gd29ybGQ, should still switch.
  • detectBase64 is only used by this paste handler, so the check can go in either place. Keep its existing tests passing.

Where to look

  • lib/base64-utils.ts: decodeText (line 11) and detectBase64 (line 65)
  • app/(tools)/base64/components/TextTab.tsx: handlePaste (line 101)
  • lib/__tests__/base64-utils.test.ts: the detectBase64 tests (line 96)

Acceptance criteria

  • Pasting password123, hello-world, 2024-01-15 or user_id_123 in Encode mode stays in Encode
  • Pasting SGVsbG8= or aGVsbG8gd29ybGQ still switches to Decode
  • Tests for both lists
  • npm run lint, npm run test and npm run build pass

Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off develop, and open your PR against develop with Closes #219 in the description.

Lingua principale
TypeScript
Stelle
1
Fork
9
Merge medio
10h 24m
PR unite (30g)
93

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di codercops/toolbelt

Tutte le issue di codercops/toolbelt

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.