|
|
@ -103,14 +103,18 @@ export async function uploadViaURL(req: Request, res: Response) { |
|
|
|
url |
|
|
|
url |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let attachmentPath; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if `url` is null, then it is local attachment
|
|
|
|
if (!attachmentUrl) { |
|
|
|
if (!attachmentUrl) { |
|
|
|
attachmentUrl = `${(req as any).ncSiteUrl}/download/${filePath.join( |
|
|
|
// then store the attachement path only
|
|
|
|
'/' |
|
|
|
// url will be constructued in `useAttachmentCell`
|
|
|
|
)}/${fileName}`;
|
|
|
|
attachmentPath = `download/${filePath.join('/')}/${fileName}`; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
url: attachmentUrl, |
|
|
|
...(url ? { url: attachmentUrl } : {}), |
|
|
|
|
|
|
|
...(attachmentPath ? { path: attachmentPath } : {}), |
|
|
|
title: fileName, |
|
|
|
title: fileName, |
|
|
|
mimetype: urlMeta.mimetype, |
|
|
|
mimetype: urlMeta.mimetype, |
|
|
|
size: urlMeta.size, |
|
|
|
size: urlMeta.size, |
|
|
|