diff --git a/packages/nocodb/src/lib/meta/api/attachmentApis.ts b/packages/nocodb/src/lib/meta/api/attachmentApis.ts index df6738763c..b55b2472ef 100644 --- a/packages/nocodb/src/lib/meta/api/attachmentApis.ts +++ b/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,