Base64: pasting text like `password123` switches to Decode and shows an error
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
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.
- Lingua principale
- TypeScript
- Stelle
- 1
- Fork
- 9
- Merge medio
- 10h 24m
- PR unite (30g)
- 93
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di codercops/toolbelt
-
bug good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 94/100
I maintainer di solito rispondono entro 1 giorno
-
Stop the JSON formatter's Find bar from typing into the JSONForse già presa @kudala-bharani l’ha presa 2 giorni fa. Apertabug hacktoberfest help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
codercops/toolbelt#121 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
JSON formatter: a duplicate key crashes the whole toolForse già presa @lb1192176991-lab l’ha presa oggi. Apertabug good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
codercops/toolbelt#218 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
JSON to XML: keys like `@type`, `$ref` or `bad key` turn into `<item>`Forse già presa @AyanZahid-Code l’ha presa oggi. Apertabug good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
codercops/toolbelt#214 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di codercops/toolbelt
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
mobile-next/mobile-mcp#526 ·
I maintainer di solito rispondono entro 1 giorno
-
e2e-failure ready-to-code
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 73/100
redhat-developer/rhdh-plugin-export-overlays#4470 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
anthropics/anthropic-sdk-typescript#1273 ·
I maintainer di solito rispondono entro 10 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
CopilotKit/OpenBot#815 ·
I maintainer di solito rispondono entro 1 giorno