Skip to content
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

[BREAKING] base64::encode() compat with esp32: no newlines by default #7910

Merged
merged 6 commits into from
Mar 15, 2021
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions cores/esp8266/base64.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,23 @@ class base64
// NOTE: The default behaviour of backend (lib64)
// is to add a newline every 72 (encoded) characters output.
// This may 'break' longer uris and json variables
static String encode(const uint8_t * data, size_t length, bool doNewLines = true);
static String inline encode(const String& text, bool doNewLines = true)
static String encode(const uint8_t * data, size_t length, bool doNewLines);
static inline String encode(const String& text, bool doNewLines)
{
return encode( (const uint8_t *) text.c_str(), text.length(), doNewLines );
}

// esp32 compat:

static inline String encode(const uint8_t * data, size_t length)
{
return encode(data, length, false);
}

static inline String encode(const String& text)
{
return encode(text, false);
}
private:
};

Expand Down