From 5ad3a854c5a120233fde1f9b4fb21e99d7eb4cff Mon Sep 17 00:00:00 2001 From: Junyi Date: Wed, 19 Jun 2024 21:22:32 +0800 Subject: [PATCH] fix(plugin-fm): fix thumbnail rule (#4707) --- .../client/src/schema-component/antd/upload/Upload.tsx | 8 +++++++- .../@nocobase/plugin-file-manager/src/server/FileModel.ts | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/core/client/src/schema-component/antd/upload/Upload.tsx b/packages/core/client/src/schema-component/antd/upload/Upload.tsx index 029ca2b850..8eacb629e4 100644 --- a/packages/core/client/src/schema-component/antd/upload/Upload.tsx +++ b/packages/core/client/src/schema-component/antd/upload/Upload.tsx @@ -106,7 +106,13 @@ function AttachmentListItem(props) { const item = [ - {file.imageUrl && {file.title}} + {file.imageUrl && ( + {file.title} + )} , {file.status === 'uploading' ? t('Uploading') : file.title} diff --git a/packages/plugins/@nocobase/plugin-file-manager/src/server/FileModel.ts b/packages/plugins/@nocobase/plugin-file-manager/src/server/FileModel.ts index bc7f97233c..e955b8d64a 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/src/server/FileModel.ts +++ b/packages/plugins/@nocobase/plugin-file-manager/src/server/FileModel.ts @@ -15,6 +15,9 @@ export class FileModel extends Model { const fileStorages = this.constructor['database']?.['_fileStorages']; if (json.storageId && fileStorages && fileStorages.has(json.storageId)) { const storage = fileStorages.get(json.storageId); + if (storage?.options?.thumbnailRule) { + json['thumbnailRule'] = storage?.options?.thumbnailRule; + } if (storage?.type === 'local' && process.env.APP_PUBLIC_PATH) { json['url'] = process.env.APP_PUBLIC_PATH.replace(/\/$/g, '') + json.url; }