mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-11-14 00:07:00 +01:00
fix: restore public file streaming and contain ZIP failures
This commit is contained in:
1 parent
ecba15ce2e
commit
c9c729c2c5
7 files changed
+226
-22
No files matched your search
@@ -111,7 +111,7 @@ export default class GitHubStream extends GitHubBase {
|
||||
logger.debug("downloading via raw URL (LFS)", { url });
|
||||
return got.stream(url, {
|
||||
hooks: { beforeRequest: [async () => { await githubTokenContext(token)?.renew(); }] },
|
||||
headers: githubTokenContext(token)?.publicRepository ? {} : { authorization: `token ${token}` },
|
||||
headers: !token || githubTokenContext(token)?.publicRepository ? {} : { authorization: `token ${token}` },
|
||||
followRedirect: true,
|
||||
});
|
||||
}
|
||||
@@ -127,7 +127,7 @@ export default class GitHubStream extends GitHubBase {
|
||||
): Promise<stream.Readable> {
|
||||
// Public raw downloads need no bearer token and do not consume the
|
||||
// unauthenticated REST API quota. GitHub also resolves LFS pointers here.
|
||||
if (githubTokenContext(token)?.publicRepository) {
|
||||
if (!token || githubTokenContext(token)?.publicRepository) {
|
||||
return Promise.resolve(this.downloadFileViaRaw(token, filePath));
|
||||
}
|
||||
return new Promise<stream.Readable>((resolve) => {
|
||||
|
||||
Reference in new issue
Block a user