Browse Source

fix(nocodb): enrich path and opt out url in uploadViaURL

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

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

@ -103,14 +103,18 @@ export async function uploadViaURL(req: Request, res: Response) {
url
);
let attachmentPath;
// if `url` is null, then it is local attachment
if (!attachmentUrl) {
attachmentUrl = `${(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: attachmentUrl,
...(url ? { url: attachmentUrl } : {}),
...(attachmentPath ? { path: attachmentPath } : {}),
title: fileName,
mimetype: urlMeta.mimetype,
size: urlMeta.size,

Loading…
Cancel
Save