Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(bitbucket): render private images in pull request descriptions #28596

OpenShpetimA(GitHub profile, opens in a new tab)wants to merge 10 commits intomain fromrefs/pull/28596/headopened View on GitHub

Showing 6 changed files with 187 additions and 0 deletions (loading 5).

x
0 of 6 viewed, 6 left
187 additions and 0 deletionspackages/source-control-bitbucket/src/server/BitbucketApi.test.tsModified
View file
@@ -741,6 +741,169 @@
}).pipe(Effect.provide(layer));
});
​
+it.effect(
+ "streams private media with current credentials only on the configured API origin",
+ () => {
+ const requests: Array<{
+ readonly url: string;
+ readonly authorization: string | undefined;
+ readonly range: string | undefined;
+ }> = [];
+ const bytes = new Uint8Array([137, 80, 78, 71, 0, 255]);
+ const { layer } = makeLayer({
+ env: { T3CODE_BITBUCKET_ACCESS_TOKEN: "environment-token" },
+ response: (request) => {
+ requests.push({
+ url: request.url,
+ authorization: request.headers.authorization,
+ range: request.headers.range,
+ });
+​
+ if (new URL(request.url).hostname === "api.bitbucket.org") {
+ return new Response(null, {
+ status: 302,
+ headers: {
+ location: "https://bbuseruploads.s3.amazonaws.com/shot.png?signature=signed",
+ },
+ });
+ }