Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): preview images outside the workspace #21064

Closedtrahane(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/21064/headopened View on GitHub

Showing 3 changed files with 26 additions and 4 deletions.

x
0 of 3 viewed, 3 left
12 additions and 0 deletionsapps/web/src/components/files/FilePreviewPanel.test.tsModified
View file
@@ -211,6 +211,18 @@
});
});
​
+ it("serves a file outside the workspace as host media, which workspace access rejects", () => {
+ expect(
+ workspaceAssetResource({ ...input, absolutePath: "/tmp/image.png", draft: false }),
+ ).toEqual({ _tag: "media-file", threadId: "thread-1", path: "/tmp/image.png" });
+ });
+​
+ it("keeps a draft's file outside the workspace on the draft resource", () => {
+ expect(
+ workspaceAssetResource({ ...input, absolutePath: "/tmp/image.png", draft: true }),
+ ).toEqual({ _tag: "draft-workspace-file", cwd: "/repo", path: "/tmp/image.png" });
+ });
+​
it("names the workspace root for a draft, which the server cannot resolve from a thread", () => {
expect(workspaceAssetResource({ ...input, draft: true })).toEqual({
_tag: "draft-workspace-file",
1 addition and 3 deletionsapps/web/src/components/files/FilePreviewPanel.tsxModified
View file
@@ -224,10 +224,8 @@
readonly title: string;
readonly workspaceMutationId: string | null;
}) {
- const insideWorkspace =
- mediaFileReference(props.absolutePath, props.workspaceRoot).relativePath !== undefined;
const resource = workspaceAssetResource({