Skip to content

Validate base64 standard encoding #1395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 8, 2024

Conversation

josh-newman
Copy link
Contributor

@josh-newman josh-newman commented Aug 6, 2024

Change Summary

Extends bytes base64 validation to accept standard encoding, in addition to the existing URL-safe.

I think a user providing base64 standard input is more likely to want successful (and unambiguous) decoding rather than a validation error. (Even while ser_json_bytes="base64" continues to emit the URL-safe variant.)

Related issue number

No issue, but this extends #1308: #1308 (comment)

Checklist

  • Unit tests for the changes exist
  • Documentation reflects the changes where applicable
  • Pydantic tests pass with this pydantic-core (except for expected changes)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Selected Reviewer: @dmontagu

@josh-newman
Copy link
Contributor Author

please review

Copy link

codecov bot commented Aug 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.61%. Comparing base (ab503cb) to head (f7170c5).
Report is 139 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1395      +/-   ##
==========================================
- Coverage   90.21%   89.61%   -0.60%     
==========================================
  Files         106      109       +3     
  Lines       16339    17308     +969     
  Branches       36       41       +5     
==========================================
+ Hits        14740    15511     +771     
- Misses       1592     1777     +185     
- Partials        7       20      +13     
Files Coverage Δ
src/validators/config.rs 100.00% <100.00%> (ø)

... and 39 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6e96b85...f7170c5. Read the comment docs.

Copy link

codspeed-hq bot commented Aug 6, 2024

CodSpeed Performance Report

Merging #1395 will not alter performance

Comparing d8e-ai:validate-base64-any (f7170c5) with main (6e96b85)

Summary

✅ 155 untouched benchmarks

Copy link
Contributor

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, feature design and implementation looks good to me!

@davidhewitt davidhewitt merged commit 585f725 into pydantic:main Aug 8, 2024
29 checks passed
@josh-newman josh-newman deleted the validate-base64-any branch August 14, 2024 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants