Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): load private GitHub release images #25027

Openmaria-rckswants to merge 3 commits intomain fromrefs/pull/25027/headopened View on GitHub

Showing 4 changed files with 155 additions and 0 deletions (loading 3).

x
0 of 4 viewed, 4 left
155 additions and 0 deletionspackages/source-control-github/src/server/gitHubMediaFetch.test.tsModified
View file
@@ -7,6 +7,7 @@
​
import * as GitHubCredentials from "./GitHubCredentials.ts";
import * as GitHubMediaFetch from "./gitHubMediaFetch.ts";
+import * as GitHubRequestPolicy from "./GitHubRequestPolicy.ts";
import * as GitHubRest from "./GitHubRest.ts";
​
const PR_REPOSITORY = "enterprise/private";
@@ -239,4 +240,158 @@
expect(fixture.requests.at(-1)?.url).toBe(fixture.signedUrls.at(-1));
}).pipe(Effect.provide(fixture.layer), Effect.scoped);
});
+​
+ describe("release downloads", () => {
+ const url = "https://github.com/owner/private/releases/download/v1%2Btest/shot%20%231%25.png";
+ const credential = {
+ token: Redacted.make("release-test-token"),
+ source: "app" as const,
+ fingerprint: "release-test",
+ };
+ const objectUrl = "https://release-assets.githubusercontent.com/shot.png?signature=test";
+​
+ it.effect(
+ "downloads the exact release asset for a tag with a slash through the API without leaking auth on redirect",
+ () => {
+ const tag = "release%2Fv1";
+ const requests: Array<{ url: string; authorization: string | undefined }> = [];
+ const lookups: Array<GitHubRest.GitHubRestInput & { pinned: string | undefined }> = [];
+ const downloadUrl = "https://api.github.com/repos/owner/private/releases/assets/42";