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:
parent
ef543dbdad
commit
cc818bad1c
@ -265,7 +265,7 @@ QJsonObject recurseAndReplace(QJsonObject &body, QByteArray &data, QString forma
|
|||||||
void CustomUploader::doUpload(QByteArray imgData, QString format) {
|
void CustomUploader::doUpload(QByteArray imgData, QString format) {
|
||||||
auto h = getHeaders(headers, format, this->rFormat);
|
auto h = getHeaders(headers, format, this->rFormat);
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
if (base64) imgData = imgData.toBase64();
|
if (base64) imgData = imgData.toBase64(QByteArray::Base64UrlEncoding);
|
||||||
|
|
||||||
switch (this->rFormat) {
|
switch (this->rFormat) {
|
||||||
case RequestFormat::PLAIN: {
|
case RequestFormat::PLAIN: {
|
||||||
|
Loading…
Reference in New Issue
Block a user