|
|
@ -111,7 +111,9 @@ export class AttachmentsService { |
|
|
|
param.urls?.map?.(async (urlMeta) => { |
|
|
|
param.urls?.map?.(async (urlMeta) => { |
|
|
|
const { url, fileName: _fileName } = urlMeta; |
|
|
|
const { url, fileName: _fileName } = urlMeta; |
|
|
|
|
|
|
|
|
|
|
|
const fileName = `${nanoid(18)}${_fileName || url.split('/').pop()}`; |
|
|
|
const fileName = `${nanoid(18)}${path.extname( |
|
|
|
|
|
|
|
_fileName || url.split('/').pop(), |
|
|
|
|
|
|
|
)}`;
|
|
|
|
|
|
|
|
|
|
|
|
const attachmentUrl = await (storageAdapter as any).fileCreateByUrl( |
|
|
|
const attachmentUrl = await (storageAdapter as any).fileCreateByUrl( |
|
|
|
slash(path.join(destPath, fileName)), |
|
|
|
slash(path.join(destPath, fileName)), |
|
|
@ -130,7 +132,7 @@ export class AttachmentsService { |
|
|
|
return { |
|
|
|
return { |
|
|
|
...(attachmentUrl ? { url: attachmentUrl } : {}), |
|
|
|
...(attachmentUrl ? { url: attachmentUrl } : {}), |
|
|
|
...(attachmentPath ? { path: attachmentPath } : {}), |
|
|
|
...(attachmentPath ? { path: attachmentPath } : {}), |
|
|
|
title: fileName, |
|
|
|
title: _fileName, |
|
|
|
mimetype: urlMeta.mimetype, |
|
|
|
mimetype: urlMeta.mimetype, |
|
|
|
size: urlMeta.size, |
|
|
|
size: urlMeta.size, |
|
|
|
icon: mimeIcons[path.extname(fileName).slice(1)] || undefined, |
|
|
|
icon: mimeIcons[path.extname(fileName).slice(1)] || undefined, |
|
|
|