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