mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-07-09 15:17:49 +02:00
fix
This commit is contained in:
@@ -126,7 +126,7 @@ export default class GitHubStream extends GitHubBase {
|
|||||||
const blobStream = this.downloadFile(token, sha);
|
const blobStream = this.downloadFile(token, sha);
|
||||||
let settled = false;
|
let settled = false;
|
||||||
|
|
||||||
const fallbackStatuses = new Set([404, 422]);
|
const fallbackStatuses = new Set([403, 404, 422]);
|
||||||
const fallbackToRaw = (statusCode?: number) => {
|
const fallbackToRaw = (statusCode?: number) => {
|
||||||
settled = true;
|
settled = true;
|
||||||
logger.info("blob API failed, falling back to raw URL", {
|
logger.info("blob API failed, falling back to raw URL", {
|
||||||
@@ -146,10 +146,12 @@ export default class GitHubStream extends GitHubBase {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Other errors: let the normal pipeline handle them.
|
// Other errors: let the normal pipeline handle them.
|
||||||
|
// Defer destroy so callers can attach error listeners before
|
||||||
|
// the error event fires, avoiding an uncaughtException crash.
|
||||||
settled = true;
|
settled = true;
|
||||||
const passthrough = new stream.PassThrough();
|
const passthrough = new stream.PassThrough();
|
||||||
passthrough.destroy(err);
|
|
||||||
resolve(passthrough);
|
resolve(passthrough);
|
||||||
|
process.nextTick(() => passthrough.destroy(err));
|
||||||
});
|
});
|
||||||
|
|
||||||
blobStream.on("response", (response) => {
|
blobStream.on("response", (response) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user