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

View File

@@ -67,8 +67,8 @@ export class WorkspaceBlobStorage {
});
}
async get(workspaceId: string, key: string) {
return this.provider.get(`${workspaceId}/${key}`);
async get(workspaceId: string, key: string, signedUrl?: boolean) {
return this.provider.get(`${workspaceId}/${key}`, signedUrl);
}
async list(workspaceId: string, syncBlobMeta = true) {

View File

@@ -43,7 +43,16 @@ export class WorkspacesController {
.user(user?.id ?? 'anonymous')
.workspace(workspaceId)
.assert('Workspace.Read');
const { body, metadata } = await this.storage.get(workspaceId, name);
const { body, metadata, redirectUrl } = await this.storage.get(
workspaceId,
name,
true
);
if (redirectUrl) {
// redirect to signed url
return res.redirect(redirectUrl);
}
if (!body) {
throw new BlobNotFound({