Skip to content

fix: avoid exception-based Base64 decoder selection#2173

Open
arnabnandy7 wants to merge 1 commit into
googleapis:mainfrom
arnabnandy7:refactor/base64-exception-flow
Open

fix: avoid exception-based Base64 decoder selection#2173
arnabnandy7 wants to merge 1 commit into
googleapis:mainfrom
arnabnandy7:refactor/base64-exception-flow

Conversation

@arnabnandy7

@arnabnandy7 arnabnandy7 commented Jul 18, 2026

Copy link
Copy Markdown
  • An issue was opened and discussed before writing the code
  • Tests and linting pass
  • Code coverage does not decrease; regression tests were added for Base64url decoding
  • Appropriate documentation was updated

Fixes #2159 ☕️

This change avoids using exceptions to select between standard Base64 and Base64url decoders. It normalizes trailing whitespace, detects Base64url-specific characters (- and _), and selects the appropriate decoder directly.

Regression tests cover padded, unpadded, and trailing-whitespace Base64url input.

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
@arnabnandy7
arnabnandy7 requested a review from a team as a code owner July 18, 2026 09:15
@product-auto-label product-auto-label Bot added the size: s Pull request size is small. label Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Core: decodeBase64() catches and falls back to base64url using exceptions for control flow

1 participant