From f6da86d61e52681e54cc97fd8d85aab7eee69f06 Mon Sep 17 00:00:00 2001 From: Sorunome Date: Sun, 16 Jul 2017 01:38:15 +0200 Subject: [PATCH 1/2] stupid me --- src/base.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base.js b/src/base.js index 22462b0..2b387b6 100644 --- a/src/base.js +++ b/src/base.js @@ -854,7 +854,7 @@ class Base { return download.getBufferAndType(avatarUrl).then(({buffer, type})=> { let opts = { name: path.basename(avatarUrl), - type.split(';')[0], + type: type.split(';')[0], rawResponse: false }; return client.uploadContent(buffer, opts); From d04cdc236cf9b3de6e60997a571220d885f753b0 Mon Sep 17 00:00:00 2001 From: Sorunome Date: Sun, 16 Jul 2017 01:44:23 +0200 Subject: [PATCH 2/2] actually this solution is way cleaner --- src/base.js | 2 +- src/utils.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/base.js b/src/base.js index 2b387b6..5cc47d6 100644 --- a/src/base.js +++ b/src/base.js @@ -854,7 +854,7 @@ class Base { return download.getBufferAndType(avatarUrl).then(({buffer, type})=> { let opts = { name: path.basename(avatarUrl), - type: type.split(';')[0], + type, rawResponse: false }; return client.uploadContent(buffer, opts); diff --git a/src/utils.js b/src/utils.js index cf83645..2eba4a8 100644 --- a/src/utils.js +++ b/src/utils.js @@ -36,6 +36,7 @@ const downloadGetBufferAndType = url => { } else { type = mime.lookup(urlParse(url).pathname); } + type = type.split(';')[0]; return { buffer, type }; }); };