base64 doesn't decode

This commit is contained in:
Natsumi
2020-12-10 11:02:23 +13:00
committed by pypy
parent 87494897b2
commit 1c4c746b55
+10 -14
View File
@@ -352,7 +352,9 @@ import gameLogService from './service/gamelog.js'
return req; return req;
} }
} else if (init.test === 'a') { } else if (init.test === 'a') {
delete init.test;
console.log("test"); console.log("test");
console.log(init);
} }
else { else {
init.headers = { init.headers = {
@@ -363,7 +365,6 @@ import gameLogService from './service/gamelog.js'
? JSON.stringify(params) ? JSON.stringify(params)
: '{}'; : '{}';
} }
console.log(init);
var req = webApiService.execute(init).catch((err) => { var req = webApiService.execute(init).catch((err) => {
this.$throw(0, err); this.$throw(0, err);
}).then((response) => { }).then((response) => {
@@ -7531,18 +7532,14 @@ import gameLogService from './service/gamelog.js'
if (!files.length) { if (!files.length) {
return; return;
} }
var based64 = '';
var r = new FileReader(); var r = new FileReader();
r.onload = function() { r.onload = function() {
based64 = btoa(r.result); var bodyStart = '---------------------------26696829785232761561272838397\nContent-Disposition: form-data; name="file"; filename="blob"\nContent-Type: image/png\n\n';
var file = { var bodyEnd = '\n---------------------------26696829785232761561272838397--\n';
filename: 'blob', var body = bodyStart + r.result + bodyEnd
private: false, var base64Body = btoa(body);
contents: based64 console.log(base64Body);
}; API.uploadVRCPlusIcon(base64Body
var array2 = { file };
console.log(JSON.stringify(array2));
API.uploadVRCPlusIcon(JSON.stringify(array2)
).then((args) => { ).then((args) => {
this.$message({ this.$message({
message: 'Icon uploaded', message: 'Icon uploaded',
@@ -7558,9 +7555,8 @@ import gameLogService from './service/gamelog.js'
return this.call('icon', { return this.call('icon', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'multipart/form-data; boundary=-------------------------26696829785232761561272838397',
'Content-Disposition': 'form-data; name="file"; filename="blob"' 'Content-Transfer-Encoding': 'base64'
//'Content-Transfer-Encoding': 'base64'
}, },
test: 'a', test: 'a',
body: params body: params