Base64: pasting text like `password123` switches to Decode and shows an error
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
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 (
decodeTextin the same file returnsok: true). - Real base64 of text, like
SGVsbG8=oraGVsbG8gd29ybGQ, should still switch. detectBase64is 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) anddetectBase64(line 65)app/(tools)/base64/components/TextTab.tsx:handlePaste(line 101)lib/__tests__/base64-utils.test.ts: thedetectBase64tests (line 96)
Acceptance criteria
- Pasting
password123,hello-world,2024-01-15oruser_id_123in Encode mode stays in Encode - Pasting
SGVsbG8=oraGVsbG8gd29ybGQstill switches to Decode - Tests for both lists
-
npm run lint,npm run testandnpm run buildpass
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
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de codercops/toolbelt
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 55/100
Los mantenedores suelen responder en 1 día
-
JWT encoder signs payloads that aren't JSON objects, and the decoder then rejects themPosiblemente ocupada @MugdhoAI la tomó hace 1 día. Abiertobug good first issue hacktoberfest
codercops/toolbelt#253 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
JSON to YAML: control characters are written raw, so PyYAML and js-yaml can't read the outputPosiblemente ocupada @anurag2787 la tomó hace 2 días. Abiertobug good first issue hacktoberfest
codercops/toolbelt#234 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
JSON formatter: Escape for code gives broken Python when the text has a run of single quotesPosiblemente ocupada @anurag2787 la tomó hace 2 días. Abiertobug good first issue hacktoberfest
codercops/toolbelt#233 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Add the URL encoder to the README, the home share card and package.jsonPosiblemente ocupada @Abhishek764 la tomó hace 4 días. Abiertodocumentation good first issue hacktoberfest
codercops/toolbelt#153 · 4 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de codercops/toolbelt
Issues similares
-
level/task type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
wazuh/wazuh-dashboard-plugins#9508 ·
Los mantenedores suelen responder en 1 día
-
Testnet EOL page links Zonescan mainnetPosiblemente ocupada @napelvs la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Azure-Samples/azure-search-openai-demo#3249 ·
Los mantenedores suelen responder en 1 día
-
[Docs] docs/architecture.mermaid leaves out 21 of the 51 src/ directoriesPosiblemente ocupada @uyg7x la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
enhancement status:needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
dongdongbh/Mindwtr#1438 ·
Los mantenedores suelen responder en 1 día