diff --git a/package.json b/package.json index 80090ebfe..7c9286324 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "@types/lodash.memoize": "^4.1.3", "@types/micromatch": "^3.1.0", "@types/nock": "^10.0.3", - "@types/node": "^10.11.3", + "@types/node": "^14", "@types/node-fetch": "^2.5.12", "@types/p-limit": "^2.0.0", "@types/prettier": "^1.16.1", diff --git a/source/api/_tests/fetch.test.ts b/source/api/_tests/fetch.test.ts index a28d735b6..e52bc0338 100644 --- a/source/api/_tests/fetch.test.ts +++ b/source/api/_tests/fetch.test.ts @@ -27,8 +27,8 @@ class TestServer { start = async (response: ResponseMock): Promise => { this.response = response - return new Promise((resolve, reject) => { - this.server.listen(this.port, this.hostname, (err: any) => (err ? reject(err) : resolve())) + return new Promise(() => { + this.server.listen(this.port, this.hostname) }) } stop = async (): Promise => { @@ -50,9 +50,9 @@ class TestProxy { private server = http.createServer(this.router) start = async (): Promise => { - return new Promise((resolve, reject) => { + return new Promise(() => { this.isRunning = true - this.server.listen(this.port, this.hostname, (err: any) => (err ? reject(err) : resolve())) + this.server.listen(this.port, this.hostname) }) } stop = async (): Promise => { diff --git a/source/platforms/github/GitHubUtils.ts b/source/platforms/github/GitHubUtils.ts index 72a9a3dad..7ba38992a 100644 --- a/source/platforms/github/GitHubUtils.ts +++ b/source/platforms/github/GitHubUtils.ts @@ -89,7 +89,10 @@ export const fileContentsGenerator = ( return "" } if (isFileContents(response.data) && response.data.content) { - const buffer = Buffer.from(response.data.content, response.data.encoding) + if (response.data.encoding !== "bsae64") { + throw new Error(`Unsupported encoding: ${response.data.encoding}`); + } + const buffer = Buffer.from(response.data.content, "base64") return buffer.toString() } else { return "" diff --git a/yarn.lock b/yarn.lock index d35c48ba0..d928b995a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1232,10 +1232,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-13.7.0.tgz#b417deda18cf8400f278733499ad5547ed1abec4" integrity sha512-GnZbirvmqZUzMgkFn70c74OQpTTUcCzlhQliTzYjQMqg+hVKcDnxdL19Ne3UdYzdMA/+W3eb646FWn/ZaT1NfQ== -"@types/node@^10.11.3": - version "10.17.55" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.55.tgz#a147f282edec679b894d4694edb5abeb595fecbd" - integrity sha512-koZJ89uLZufDvToeWO5BrC4CR4OUfHnUz2qoPs/daQH6qq3IN62QFxCTZ+bKaCE0xaoCAJYE4AXre8AbghCrhg== +"@types/node@^14": + version "14.18.12" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.12.tgz#0d4557fd3b94497d793efd4e7d92df2f83b4ef24" + integrity sha512-q4jlIR71hUpWTnGhXWcakgkZeHa3CCjcQcnuzU8M891BAWA2jHiziiWEPEkdS5pFsz7H9HJiy8BrK7tBRNrY7A== "@types/p-limit@^2.0.0": version "2.0.0"