Browse Source

feat(nocodb): add path to attachment object conditionally

pull/4931/head
Wing-Kam Wong 2 years ago
parent
commit
52d27a0de6
  1. 12
      packages/nocodb/src/lib/meta/api/attachmentApis.ts

12
packages/nocodb/src/lib/meta/api/attachmentApis.ts

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

Loading…
Cancel
Save