The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 13:15 UTC
fix(server): image attachments report their size when the T3 home is behind a symlink (#24245)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net>
MarcoDotIO committed
Oct 29, 2026 at 13:44 UTC
3b066dad5c7fa1db5803d655da5a803dde9c77d1
2 files changed
+31
-1
apps/server/src/assets/AssetAccess.test.ts
+27
@@ -1199,6 +1199,33 @@ describe("AssetAccess", () => {
1199
}).pipe(Effect.provide(layerTest)),
1200
);
1201
1202
+ it.effect.skipIf(!symlinksSupported)(
1203
+ "reports image attachment dimensions when the attachments directory is a symlink",
1204
+ () =>
1205
+ Effect.gen(function* () {
1206
+ const config = yield* ServerConfig.ServerConfig;
1207
+ const fs = yield* FileSystem.FileSystem;
1208
+ const path = yield* Path.Path;
1209
+ const root = yield* fs.makeTempDirectoryScoped({ prefix: "t3-attachments-link-" });
1210
+ const realAttachmentsDir = path.join(root, "real");
1211
+ const linkedAttachmentsDir = path.join(root, "linked");
1212
+ yield* fs.makeDirectory(realAttachmentsDir);
1213
+ yield* fs.symlink(realAttachmentsDir, linkedAttachmentsDir);
1214
+ const attachmentId = "thread-1-00000000-0000-4000-8000-000000000041";
1215
+ yield* fs.writeFile(path.join(realAttachmentsDir, `${attachmentId}.png`), screenshotPng);
1216
+
1217
+ const result = yield* issueAssetUrl({
1218
+ resource: { _tag: "attachment", attachmentId },
1219
+ }).pipe(
1220
+ Effect.provideService(ServerConfig.ServerConfig, {
1221
+ ...config,
1222
+ attachmentsDir: linkedAttachmentsDir,
1223
+ }),
1224
+ );
1225
+ expect(result.imageDimensions).toEqual({ width: 390, height: 844 });
1226
+ }).pipe(Effect.provide(layerTest)),
1227
+ );
1228
+
1229
it.effect("serves document attachments inline when a viewer requests it", () =>
1230
Effect.gen(function* () {
1231
const config = yield* ServerConfig.ServerConfig;
apps/server/src/assets/AssetAccess.ts
+4
-1
@@ -659,7 +659,10 @@ export const issueAssetUrl = Effect.fn("AssetAccess.issueAssetUrl")(function* (i
659
? inlinePreviewMimeTypeForExtension(extension)
660
: undefined;
661
if (!isGenericFile) {
662
- imageDimensions = yield* readImageDimensionsFromHeader(attachmentPath);
662
+ imageDimensions = yield* fileSystem.realPath(attachmentPath).pipe(
663
+ Effect.flatMap(readImageDimensionsFromHeader),
664
+ Effect.orElseSucceed(() => null),
665
+ );
666
}
667
claims = {
668
version: 1,