Browse Source

use knownLength in form-data

feature/dockerfile-arm
Evan Feenstra 5 years ago
parent
commit
fbd81e44be
  1. 2
      api/network/modify.ts
  2. 2
      dist/api/network/modify.js
  3. 2
      dist/api/network/modify.js.map

2
api/network/modify.ts

@ -24,7 +24,6 @@ export async function modifyPayload(payload, chat) {
if(!terms.host) return payload
try {
console.log(`Bearer ${meme.mediaToken}`)
const r = await fetch(`https://${terms.host}/file/${mt}`, {
headers: {'Authorization': `Bearer ${meme.mediaToken}`}
})
@ -49,6 +48,7 @@ export async function modifyPayload(payload, chat) {
bod.append('file', encImgBuffer, {
contentType: typ||'image/jpg',
filename: 'Image.jpg',
knownLength:encImgBuffer.length,
})
const resp = await fetch(`https://${terms.host}/file`, {
method: 'POST',

2
dist/api/network/modify.js

@ -33,7 +33,6 @@ function modifyPayload(payload, chat) {
if (!terms.host)
return payload;
try {
console.log(`Bearer ${meme.mediaToken}`);
const r = yield fetch(`https://${terms.host}/file/${mt}`, {
headers: { 'Authorization': `Bearer ${meme.mediaToken}` }
});
@ -52,6 +51,7 @@ function modifyPayload(payload, chat) {
bod.append('file', encImgBuffer, {
contentType: typ || 'image/jpg',
filename: 'Image.jpg',
knownLength: encImgBuffer.length,
});
const resp = yield fetch(`https://${terms.host}/file`, {
method: 'POST',

2
dist/api/network/modify.js.map

@ -1 +1 @@
{"version":3,"file":"modify.js","sourceRoot":"","sources":["../../../api/network/modify.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA4B;AAC5B,kDAA0C;AAC1C,oCAAmC;AACnC,wCAAuC;AACvC,qCAAoC;AACpC,iCAAgC;AAChC,sCAAqC;AACrC,sCAAqC;AAErC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,6BAA6B,CAAC,CAAC,CAAA;AAC7E,MAAM,QAAQ,GAAG,SAAS,CAAC,aAAa,CAAA;AAExC,SAAsB,aAAa,CAAC,OAAO,EAAE,IAAI;;QAC/C,IAAG,OAAO,C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