From 2f2d4438a26cf6063caa9be27424b799f077c54d Mon Sep 17 00:00:00 2001 From: MattVador Date: Tue, 22 May 2018 22:52:58 +0200 Subject: [PATCH] Update syno.js If response is not "text/plain" like "image/jpeg" do not try to get error in data result. --- dist/syno.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/syno.js b/dist/syno.js index ebc9060..5534fbd 100644 --- a/dist/syno.js +++ b/dist/syno.js @@ -74,7 +74,7 @@ error.response = response; return done(error); } - if (!body.success || (body.success && body.data && body.data instanceof Array && body.data[0] && body.data[0].error)) { + if ( response.headers["content-type"]=='text/plain; charset="UTF-8"' && (!body.success || (body.success && body.data && body.data instanceof Array && body.data[0] && body.data[0].error)) ) { code = body.error ? body.error.code : body.data[0].error; error = new Error(_this.error(code, api)); error.code = code;