fix: do not resolve storage provider in getUrl (#6361)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-08-21 15:58:17 +07:00 committed by GitHub
parent 84803fa372
commit 5d41a873d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,8 +10,8 @@ import core, {
type WorkspaceId
} from '@hcengineering/core'
import { type Readable } from 'stream'
import { type RawDBAdapter } from '../adapter'
import { getMetadata } from '@hcengineering/platform'
import {
type BlobStorageIterator,
type BucketInfo,
@ -20,6 +20,9 @@ import {
type StorageAdapterEx,
type UploadedObjectInfo
} from '@hcengineering/storage'
import { type RawDBAdapter } from '../adapter'
import serverCore from '../plugin'
import { type StorageConfig, type StorageConfiguration } from '../types'
class NoSuchKeyError extends Error {
@ -367,8 +370,10 @@ export class AggregatorStorageAdapter implements StorageAdapter, StorageAdapterE
@withContext('aggregator-getUrl', {})
async getUrl (ctx: MeasureContext, workspaceId: WorkspaceId, name: string): Promise<string> {
const { provider, stat } = await this.findProvider(ctx, workspaceId, name)
return await provider.getUrl(ctx, workspaceId, stat.storageId)
// const { provider, stat } = await this.findProvider(ctx, workspaceId, name)
// return await provider.getUrl(ctx, workspaceId, stat.storageId)
const filesUrl = getMetadata(serverCore.metadata.FilesUrl) ?? ''
return filesUrl.replaceAll(':workspace', workspaceId.name).replaceAll(':blobId', name)
}
}