mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-23 03:49:49 +00:00
Fix love records (#6889)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
211f4ed3c5
commit
00d8cf2935
@ -79,8 +79,10 @@ export const main = async (): Promise<void> => {
|
||||
const data = dataByUUID.get(res.filename)
|
||||
if (data !== undefined) {
|
||||
const client = await WorkspaceClient.create(data.workspace)
|
||||
await storageAdapter.syncBlobFromStorage(ctx, data.workspaceId, res.filename, storageConfig?.name)
|
||||
await client.saveFile(res.filename, data.name)
|
||||
const prefix = rootPrefix(storageConfig, data.workspaceId)
|
||||
const filename = stripPrefix(prefix, res.filename)
|
||||
await storageAdapter.syncBlobFromStorage(ctx, data.workspaceId, filename, storageConfig?.name)
|
||||
await client.saveFile(filename, data.name)
|
||||
await client.close()
|
||||
dataByUUID.delete(res.filename)
|
||||
} else {
|
||||
@ -203,6 +205,17 @@ function getDocumentKey (storageConfig: any, workspace: WorkspaceId, name: strin
|
||||
return storageConfig.rootBucket === undefined ? name : `${getBucketFolder(workspace)}/${name}`
|
||||
}
|
||||
|
||||
function stripPrefix (prefix: string | undefined, key: string): string {
|
||||
if (prefix !== undefined && key.startsWith(prefix)) {
|
||||
return key.slice(prefix.length)
|
||||
}
|
||||
return key
|
||||
}
|
||||
|
||||
function rootPrefix (storageConfig: any, workspaceId: WorkspaceId): string | undefined {
|
||||
return storageConfig.rootBucket !== undefined ? getBucketFolder(workspaceId) + '/' : undefined
|
||||
}
|
||||
|
||||
const startRecord = async (
|
||||
storageConfig: StorageConfig | undefined,
|
||||
egressClient: EgressClient,
|
||||
|
Loading…
Reference in New Issue
Block a user