Add URL-Encoding to base64

Adding QByteArray::Base64UrlEncoding to the args of imgData.toBase64() will add better compatibility when sending it over to something like PHP or JS. Essentially, it replaces all spaces with - . You could also do QByteArray::Base64Encoding which will replace all spaces with + instead of -. However, the - tends to work better amongst other things.

Either one is better than nothing.
This commit is contained in:
Linkjay 2018-02-25 12:07:59 -08:00 committed by GitHub
parent ef543dbdad
commit cc818bad1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -265,7 +265,7 @@ QJsonObject recurseAndReplace(QJsonObject &body, QByteArray &data, QString forma
void CustomUploader::doUpload(QByteArray imgData, QString format) {
auto h = getHeaders(headers, format, this->rFormat);
QByteArray data;
if (base64) imgData = imgData.toBase64();
if (base64) imgData = imgData.toBase64(QByteArray::Base64UrlEncoding);
switch (this->rFormat) {
case RequestFormat::PLAIN: {