Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Cerrado Apto para principiantes
#219 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
92/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
nextjs, typescript
Área
frontend

Línea de trabajo

Comienza con lib/base64-utils.ts, especialmente decodeText y detectBase64, y luego inspecciona handlePaste en app/(tools)/base64/components/TextTab.tsx. Agrega o actualiza las pruebas en lib/__tests__/base64-utils.test.ts para cubrir los falsos positivos indicados y el texto Base64 válido, y verifica con npm run lint, npm run test y npm run build.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
1
Forks
9
Merge medio
9 h 9 min
PR fusionados (30 d)
118

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de codercops/toolbelt

Todos los issues de codercops/toolbelt

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.