mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 05:14:54 +00:00
feat(server): s3 presigned url (#11364)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user