Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): load pull request images from private repositories #6601

Closedartieeg(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/6601/headopened View on GitHub

Showing 12 changed files with 97 additions and 6 deletions (loading 10).

x
0 of 12 viewed, 12 left
38 additions and 3 deletionsapps/server/src/assets/AssetAccess.test.tsModified
View file
@@ -1,5 +1,9 @@
import * as NodeServices from "@effect/platform-node/NodeServices";
-import { AssetPreviewTypeValidationError, ThreadId } from "@t3tools/contracts";
+import {
+ AssetGitHubAttachmentUrlValidationError,
+ AssetPreviewTypeValidationError,
+ ThreadId,
+} from "@t3tools/contracts";
import { PROJECT_FAVICON_FALLBACK_MARKER } from "@t3tools/shared/projectFavicon";
import { describe, expect, it } from "@effect/vitest";
import * as Crypto from "effect/Crypto";
@@ -31,6 +35,31 @@
).pipe(Layer.provideMerge(NodeServices.layer));
​
describe("AssetAccess", () => {
+ it.effect("signs only GitHub user attachment URLs", () =>
+ Effect.gen(function* () {
+ const url = "https://github.com/user-attachments/assets/dec6b30a-7724-4590-802a-af5586a2724d";
+ const result = yield* issueAssetUrl({
+ resource: { _tag: "github-user-attachment", url },
+ });
+ const suffix = result.relativeUrl.slice(`${ASSET_ROUTE_PREFIX}/`.length);
+ const separatorIndex = suffix.indexOf("/");
+ expect(
+ yield* resolveAsset(suffix.slice(0, separatorIndex), suffix.slice(separatorIndex + 1)),
+ ).toEqual({
+ kind: "github-user-attachment",
+ url,
+ });
+​