Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 20737e9

Browse files
Fix: attachements are not loaded
1 parent 2362a4b commit 20737e9

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

apps/server/src/modules/attachments/attachments.controller.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,34 @@ export class AttachmentController {
9090
}
9191
}
9292

93+
@Get(':workspaceId/:attachmentId')
94+
@UseGuards(AuthGuard)
95+
async getFileFromGCSForWorkspace(
96+
@Param() attachementRequestParams: AttachmentRequestParams,
97+
@Res() res: Response,
98+
) {
99+
try {
100+
const { signedUrl, contentType } =
101+
await this.attachementService.getFileFromStorageSignedUrl(
102+
attachementRequestParams,
103+
attachementRequestParams.workspaceId,
104+
);
105+
106+
// Set content disposition header with the original filename
107+
res.set({
108+
'Content-Type': contentType,
109+
'Content-Disposition': 'inline',
110+
'Cache-Control': 'public, immutable, max-age=31536000', // Cache for 1 year (effectively infinite)
111+
});
112+
113+
https.get(signedUrl, (stream) => {
114+
stream.pipe(res);
115+
});
116+
} catch (error) {
117+
res.status(404).send('File not found');
118+
}
119+
}
120+
93121
@Get(':attachmentId')
94122
@UseGuards(AuthGuard)
95123
async getFileFromGCS(

apps/server/src/modules/attachments/attachments.interface.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import { IsOptional, IsString } from 'class-validator';
33
export class AttachmentRequestParams {
44
@IsString()
55
attachmentId: string;
6+
7+
@IsString()
8+
workspaceId: string;
69
}
710

811
export interface ExternalFile {

apps/server/src/modules/attachments/attachments.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class AttachmentService {
5959
contentType: file.contentType,
6060
});
6161

62-
const publicURL = `${process.env.PUBLIC_ATTACHMENT_URL}/v1/attachment/${workspaceId}/${attachment.id}`;
62+
const publicURL = `${process.env.PUBLIC_ATTACHMENT_URL}/v1/attachment/${attachment.id}`;
6363

6464
return {
6565
url,

packages/ui/src/custom.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,12 @@ ul[data-type='taskList'] li[data-checked='true'] > div > p {
8181

8282
.side-issue-view .context-box {
8383
@apply border border-border;
84+
border-radius: 0 !important;
8485
box-shadow: 0px 16px 32px 0px rgba(20, 20, 20, 0.2) !important;
8586
}
8687

8788
.side-issue-view .main-container {
88-
@apply py-2;
89+
padding: 0 !important;
8990
}
9091

9192
.dark .side-issue-view .context-box {

0 commit comments

Comments
 (0)