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 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,

Loading…
Cancel
Save