fix(plugin-fm): fix thumbnail rule (#4707)

This commit is contained in:
Junyi 2024-06-19 21:22:32 +08:00 committed by GitHub
parent 283f1d6000
commit 5ad3a854c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -106,7 +106,13 @@ function AttachmentListItem(props) {
const item = [ const item = [
<span key="thumbnail" className={`${prefixCls}-list-item-thumbnail`}> <span key="thumbnail" className={`${prefixCls}-list-item-thumbnail`}>
{file.imageUrl && <img src={file.imageUrl} alt={file.title} className={`${prefixCls}-list-item-image`} />} {file.imageUrl && (
<img
src={`${file.imageUrl}${file.thumbnailRule || ''}`}
alt={file.title}
className={`${prefixCls}-list-item-image`}
/>
)}
</span>, </span>,
<span key="title" className={`${prefixCls}-list-item-name`} title={file.title}> <span key="title" className={`${prefixCls}-list-item-name`} title={file.title}>
{file.status === 'uploading' ? t('Uploading') : file.title} {file.status === 'uploading' ? t('Uploading') : file.title}

View File

@ -15,6 +15,9 @@ export class FileModel extends Model {
const fileStorages = this.constructor['database']?.['_fileStorages']; const fileStorages = this.constructor['database']?.['_fileStorages'];
if (json.storageId && fileStorages && fileStorages.has(json.storageId)) { if (json.storageId && fileStorages && fileStorages.has(json.storageId)) {
const storage = fileStorages.get(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) { if (storage?.type === 'local' && process.env.APP_PUBLIC_PATH) {
json['url'] = process.env.APP_PUBLIC_PATH.replace(/\/$/g, '') + json.url; json['url'] = process.env.APP_PUBLIC_PATH.replace(/\/$/g, '') + json.url;
} }