diff --git a/dev/tool/src/storage.ts b/dev/tool/src/storage.ts index 098d4f6a1bd..6231c8ca366 100644 --- a/dev/tool/src/storage.ts +++ b/dev/tool/src/storage.ts @@ -34,6 +34,7 @@ export async function moveFiles ( for (const [name, adapter] of exAdapter.adapters.entries()) { if (name === target) continue + console.log('moving from', name) const iterator = await adapter.listStream(ctx, workspaceId) while (true) { @@ -44,9 +45,16 @@ export async function moveFiles ( if (blob === undefined) continue if (blob.provider === target) continue - const readable = await exAdapter.get(ctx, workspaceId, data._id) - const stream = readable.pipe(new PassThrough()) - await exAdapter.put(ctx, workspaceId, data._id, stream, blob.contentType, blob.size) + try { + const readable = await exAdapter.get(ctx, workspaceId, data._id) + readable.on('end', () => { + readable.destroy() + }) + const stream = readable.pipe(new PassThrough()) + await exAdapter.put(ctx, workspaceId, data._id, stream, blob.contentType, blob.size) + } catch (err) { + console.error('failed to process blob', name, data._id, err) + } count += 1 if (count % 100 === 0) { diff --git a/packages/presentation/src/file.ts b/packages/presentation/src/file.ts index 769b9dad4f7..0a0066a2798 100644 --- a/packages/presentation/src/file.ts +++ b/packages/presentation/src/file.ts @@ -72,7 +72,7 @@ export function getFileUrl (file: string, filename?: string): string { const template = getFilesUrl() return template - .replaceAll(':filename', encodeURIComponent(filename ?? '')) + .replaceAll(':filename', encodeURIComponent(filename ?? file)) .replaceAll(':workspace', encodeURIComponent(getCurrentWorkspace())) .replaceAll(':blobId', encodeURIComponent(file)) } diff --git a/packages/presentation/src/preview.ts b/packages/presentation/src/preview.ts index 1f0a95b312e..ed22aada998 100644 --- a/packages/presentation/src/preview.ts +++ b/packages/presentation/src/preview.ts @@ -74,8 +74,6 @@ function blobToSrcSet (cfg: PreviewConfig, blob: Ref, width: number | unde ' 2x, ' + fu.replaceAll(':size', `${width * 3}`) + ' 3x' - } else { - result += downloadUrl } return result diff --git a/plugins/chunter-resources/src/components/chat/create/CreateChannel.svelte b/plugins/chunter-resources/src/components/chat/create/CreateChannel.svelte index ca7cdddffea..f9dfcab2bd5 100644 --- a/plugins/chunter-resources/src/components/chat/create/CreateChannel.svelte +++ b/plugins/chunter-resources/src/components/chat/create/CreateChannel.svelte @@ -68,14 +68,6 @@ topic: description }) - await client.createDoc(notification.class.DocNotifyContext, space._id, { - user: account._id, - objectId: channelId, - objectClass: chunter.class.Channel, - objectSpace: core.space.Space, - isPinned: false - }) - openChannel(channelId, chunter.class.Channel) } diff --git a/server-plugins/notification-resources/src/utils.ts b/server-plugins/notification-resources/src/utils.ts index db16ff0b489..4c864a4fb9a 100644 --- a/server-plugins/notification-resources/src/utils.ts +++ b/server-plugins/notification-resources/src/utils.ts @@ -151,7 +151,7 @@ export function isAllowed ( notificationControl: NotificationProviderControl ): boolean { const providerSetting = (notificationControl.byProvider.get(provider._id) ?? []).find( - ({ attachedTo, modifiedBy }) => modifiedBy === receiver + ({ createdBy }) => createdBy === receiver ) if (providerSetting !== undefined && !providerSetting.enabled) { @@ -168,7 +168,7 @@ export function isAllowed ( return false } const setting = (notificationControl.settingsByProvider.get(provider._id) ?? []).find( - (it) => it.type === type._id && it.modifiedBy === receiver + (it) => it.type === type._id && it.createdBy === receiver ) if (setting !== undefined) { diff --git a/server/core/src/server/aggregator.ts b/server/core/src/server/aggregator.ts index 7b42e998324..6ed1b3139e9 100644 --- a/server/core/src/server/aggregator.ts +++ b/server/core/src/server/aggregator.ts @@ -256,12 +256,8 @@ export class AggregatorStorageAdapter implements StorageAdapter, StorageAdapterE @withContext('aggregator-get', {}) async get (ctx: MeasureContext, workspaceId: WorkspaceId, name: string): Promise { - // const { provider, stat } = await this.findProvider(ctx, workspaceId, name) - const provider = this.adapters.get(this.defaultAdapter) - if (provider === undefined) { - throw new NoSuchKeyError('No such provider found') - } - return await provider.get(ctx, workspaceId, name) + const { provider, stat } = await this.findProvider(ctx, workspaceId, name) + return await provider.get(ctx, workspaceId, stat.storageId) } @withContext('find-provider', {})