Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): resolve local media linked from remote threads #10619

Mergedmaria-rcksmerged 3 commits intomain fromrefs/pull/10619/headmerged by maria-rcks View on GitHub

Showing 6 changed files with 61 additions and 2 deletions (loading 3).

x
0 of 6 viewed, 6 left
37 additions and 0 deletionsapps/server/src/server.test.tsModified
View file
@@ -5473,6 +5473,43 @@
}).pipe(Effect.provide(NodeHttpServer.layerTest)),
+ it.effect("serves absolute host media without a local thread and rejects relative media", () =>
+ Effect.gen(function* () {
+ yield* buildAppUnderTest();
+ const fileSystem = yield* FileSystem.FileSystem;
+ const path = yield* Path.Path;
+ const directory = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-host-media-" });
+ const wsUrl = yield* getWsServerUrl("/ws");
+ const threadId = ThreadId.make("thread-on-another-environment");
+​
+ yield* Effect.scoped(
+ withWsRpcClient(wsUrl, (client) =>
+ Effect.gen(function* () {
+ for (const [name, mimeType] of [
+ ["screenshot.png", "image/png"],
+ ["recording.mp4", "video/mp4"],
+ ] as const) {
+ const filePath = path.join(directory, name);
+ yield* fileSystem.writeFileString(filePath, "host media bytes");
+ const issued = yield* client[WS_METHODS.assetsCreateUrl]({
+ resource: { _tag: "media-file", threadId, path: filePath },
+ });
+ const response = yield* HttpClient.get(issued.relativeUrl);
+ assert.equal(response.status, 200);
+ assert.equal(response.headers["content-type"], mimeType);
+ assert.equal(yield* response.text, "host media bytes");
+​