Byron / google-apis-rs

A binding and CLI generator for all Google APIs
http://byron.github.io/google-apis-rs
Other
983 stars 132 forks source link

Tolerant base64 decoding. Accept url-safe or standard encoding in responses. #506

Closed dantreiman closed 1 month ago

dantreiman commented 1 month ago

Attempts to decode bytes fields in response JSON using both standard and url_safe encodings. The expected encoding's desierializer is tried first. On error the second is attempted. If the second fails, the original error from the first is returned.

Fixes https://github.com/Byron/google-apis-rs/issues/502

Likely fixes other bugs too but I haven't tested

dantreiman commented 1 month ago

Sounds good. I've added two cases using +, / and -, _ respectively to ensure decoder doesn't error out. Changed failure case to a character outside either accepted base64 character set.