Skip to content

utilities: make utils::isBase64 support padding#2472

Merged
an-tao merged 1 commit intodrogonframework:masterfrom
MouhK:feature/padding-friendly-is-base64
Mar 26, 2026
Merged

utilities: make utils::isBase64 support padding#2472
an-tao merged 1 commit intodrogonframework:masterfrom
MouhK:feature/padding-friendly-is-base64

Conversation

@MouhK
Copy link
Copy Markdown
Contributor

@MouhK MouhK commented Mar 25, 2026

Following RFC 4648 utils::isBase64 should accept padded encoded data. Current implementation allows URL characters '-, _' so it should also support padding character ('=').

More over with current implementation the following code fails, which doesn't make sense.

std::string in{"drogon framework"};
auto encoded = drogon::utils::base64Encode(in);
if (!drogon::utils::isBase64(encoded))
    std::cerr << "Not base64" << std::endl;

$ output = Not base64

@MouhK MouhK force-pushed the feature/padding-friendly-is-base64 branch from b06dea4 to a6ca551 Compare March 25, 2026 13:51
@an-tao an-tao merged commit 0df25d4 into drogonframework:master Mar 26, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants