feat(server): s3 presigned url (#11364)

This commit is contained in:
darkskygit
2025-04-01 15:14:06 +00:00
parent dad858014f
commit f2e2072878
13 changed files with 233 additions and 32 deletions
@@ -602,7 +602,17 @@ export class CopilotController implements BeforeApplicationShutdown {
@Param('workspaceId') workspaceId: string,
@Param('key') key: string
) {
const { body, metadata } = await this.storage.get(userId, workspaceId, key);
const { body, metadata, redirectUrl } = await this.storage.get(
userId,
workspaceId,
key,
true
);
if (redirectUrl) {
// redirect to signed url
return res.redirect(redirectUrl);
}
if (!body) {
throw new BlobNotFound({
@@ -56,8 +56,13 @@ export class CopilotStorage {
}
@CallMetric('ai', 'blob_get')
async get(userId: string, workspaceId: string, key: string) {
return this.provider.get(`${userId}/${workspaceId}/${key}`);
async get(
userId: string,
workspaceId: string,
key: string,
signedUrl?: boolean
) {
return this.provider.get(`${userId}/${workspaceId}/${key}`, signedUrl);
}
@CallMetric('ai', 'blob_delete')