Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Base64 Decoder: show precise errors for invalid characters and padding

已关闭
#406 2 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@srikar-naidu 已经在做这个了。

开始于 2026年10月28日。

  • #417 来自 @srikar-naidu —— 未关闭

评估

这个 Issue 还没有评估数据。

描述

enhancement hacktoberfest
What problem does this solve?

When Base64 decoding fails, a generic error makes it difficult to find the problem in a long input.

Identifying the invalid character or padding position would help users fix malformed tokens, copied payloads, and encoded file contents more quickly.

Proposed solution

Improve Base64 validation and decoding errors with specific explanations and input positions.

Scope
  • Identify invalid characters and their positions in the original input.
  • Detect padding placed before the end of the encoded content.
  • Detect excessive padding and invalid encoded lengths.
  • Detect inputs mixing standard Base64 characters (+, /) with URL-safe characters (-, _).
  • Explain which alphabet is accepted by the selected decoding mode.
  • Preserve the tool’s existing handling of whitespace, missing padding, and data-URI prefixes where supported.
  • Keep valid Base64 that decodes to binary distinguishable from a decoding failure.
  • Do not silently remove invalid characters or rewrite the input.
Acceptance criteria
  • Invalid characters produce an actionable message with a 1-based position.
  • Positions refer to the original input, including when whitespace or a supported data-URI prefix is present.
  • Misplaced padding, excessive padding, and impossible lengths have distinct messages.
  • Mixed alphabets produce a clear explanation consistent with the selected mode.
  • Valid standard and URL-safe inputs continue to decode correctly.
  • Existing supported unpadded inputs remain supported.
  • Valid binary output is not reported as malformed Base64 merely because it is not UTF-8 text.
  • Failed decoding clears stale output.
  • Error messages are accessible and readable in both site themes.
  • Validation logic lives in lib/ with tests for each error category and existing accepted input formats.
  • All validation and decoding happen locally in the browser.
  • npm run lint && npm run test && npm run build pass.

Automatic input repair, new encoding formats, and changes to file-size limits are outside this issue’s scope.

Fit
  • This can work entirely in the browser with no server or data leaving the tab.
主要语言
TypeScript
星标
1
派生
9
平均合并
7 小时 48 分钟
30 天内合并 PR
187

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

codercops/toolbelt 的其他 Issue

查看 codercops/toolbelt 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。