mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-12-02 17:13:33 +01:00
fix: report a jsDelivr 404 as repo_not_found, not token_expired
Without owner access, a jsDelivr 404 was sent to the GitHub API probe, which cannot run for the CDN token and failed with token_expired. The path comes from the stored tree of a pinned commit, so a CDN 404 means the repository is no longer public. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
28b154b0eb
commit
f02999e774
2 files changed
+11
No files matched your search
@@ -56,6 +56,12 @@ describe("jsDelivr access without owner credentials", function () {
|
||||
await repo.refreshIfNeeded();
|
||||
});
|
||||
|
||||
it("reports a CDN 404 as an unavailable repository, not an expired token", async () => {
|
||||
const { classifyContentMiss } = require("../src/core/source/github-content-miss");
|
||||
const data = { repoId: "r", organization: "owner", repoName: "gone", commit, getToken: () => PUBLIC_CDN_TOKEN };
|
||||
expect(await classifyContentMiss(data, PUBLIC_CDN_TOKEN)).to.equal("repo_not_found");
|
||||
});
|
||||
|
||||
it("encodes owner, repository and path segments", () => {
|
||||
expect(jsDelivrFileUrl("o", "r", commit, "x/%2e")).to.equal(`https://cdn.jsdelivr.net/gh/o/r@${commit}/x/%252e`);
|
||||
for (const path of ["../x", "a/./b", "a//b", ""]) expect(() => jsDelivrFileUrl("o", "r", commit, path)).to.throw("invalid_path");
|
||||
|
||||
Reference in new issue
Block a user