From 6c91854391c8b6d391b02338db44c14cc3f1a0ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20=C3=96stberg?= Date: Thu, 3 Dec 2020 20:41:31 +0100 Subject: [PATCH 1/2] Fix missing authentication in GitHubUrlReader An oversight that probably stems from that most repositories for tech-docs are public anyway. Ours are not, and are inside of a GitHub Enterprise, which is how i found this tiny bug. I wish i knew how to mock the cross-fetch in order to inspect the Authorization header of the request to test this fix. I can only confirm that it works on our backstage that targets GHE. --- packages/backend-common/src/reading/GithubUrlReader.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/backend-common/src/reading/GithubUrlReader.ts b/packages/backend-common/src/reading/GithubUrlReader.ts index 692a3c6dd8..278fb70eb3 100644 --- a/packages/backend-common/src/reading/GithubUrlReader.ts +++ b/packages/backend-common/src/reading/GithubUrlReader.ts @@ -196,6 +196,7 @@ export class GithubUrlReader implements UrlReader { new URL( `${protocol}://${resource}/${full_name}/archive/${ref}.tar.gz`, ).toString(), + getApiRequestOptions(this.config) ); if (!response.ok) { const message = `Failed to read tree from ${url}, ${response.status} ${response.statusText}`; From be98e222eeb976f987c65765619ff4a8c838f84a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20=C3=96stberg?= Date: Fri, 4 Dec 2020 09:06:26 +0100 Subject: [PATCH 2/2] Update GithubUrlReader.ts --- packages/backend-common/src/reading/GithubUrlReader.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend-common/src/reading/GithubUrlReader.ts b/packages/backend-common/src/reading/GithubUrlReader.ts index 278fb70eb3..de798a7067 100644 --- a/packages/backend-common/src/reading/GithubUrlReader.ts +++ b/packages/backend-common/src/reading/GithubUrlReader.ts @@ -196,7 +196,7 @@ export class GithubUrlReader implements UrlReader { new URL( `${protocol}://${resource}/${full_name}/archive/${ref}.tar.gz`, ).toString(), - getApiRequestOptions(this.config) + getRawRequestOptions(this.config), ); if (!response.ok) { const message = `Failed to read tree from ${url}, ${response.status} ${response.statusText}`;