From 058289e8bd6d3820beff6f924538055afb96d83d Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Thu, 18 Oct 2018 04:42:38 +0200 Subject: [PATCH] fix(githhub): handle empty file --- lib/platform/github/storage.js | 8 +++----- test/platform/github/index.spec.js | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/platform/github/storage.js b/lib/platform/github/storage.js index cfe0203537..e5f331b3fc 100644 --- a/lib/platform/github/storage.js +++ b/lib/platform/github/storage.js @@ -250,12 +250,10 @@ class Storage { } if (res && res.body) { if (res.body.content) { - if (res.body.content.length) { - return Buffer.from(res.body.content, 'base64').toString(); - } - // istanbul ignore next - return ''; + return Buffer.from(res.body.content, 'base64').toString(); } + // istanbul ignore next + return ''; } return null; } diff --git a/test/platform/github/index.spec.js b/test/platform/github/index.spec.js index 346596dacb..a41c2dcd9a 100644 --- a/test/platform/github/index.spec.js +++ b/test/platform/github/index.spec.js @@ -1908,9 +1908,7 @@ describe('platform/github', () => { ], }, })); - get.mockImplementationOnce(() => ({ - body: {}, - })); + get.mockImplementationOnce(() => ({})); const content = await github.getFile('package.json'); expect(get.mock.calls).toMatchSnapshot(); expect(content).toBe(null); -- GitLab