Browse Source

fix(gui): export csv - populate correct attachment url

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4931/head
Pranav C 2 years ago
parent
commit
4b6cf818b3
  1. 8
      packages/nocodb/src/lib/meta/api/dataApis/helpers.ts

8
packages/nocodb/src/lib/meta/api/dataApis/helpers.ts

@ -160,6 +160,7 @@ async function getDbRows(baseModel, view: View, req: Request) {
dbRow[column.title] = await serializeCellValue({ dbRow[column.title] = await serializeCellValue({
value: row[column.title], value: row[column.title],
column, column,
siteUrl: req['ncSiteUrl'],
}); });
} }
dbRows.push(dbRow); dbRows.push(dbRow);
@ -171,9 +172,11 @@ async function getDbRows(baseModel, view: View, req: Request) {
export async function serializeCellValue({ export async function serializeCellValue({
value, value,
column, column,
siteUrl,
}: { }: {
column?: Column; column?: Column;
value: any; value: any;
siteUrl: string;
}) { }) {
if (!column) { if (!column) {
return value; return value;
@ -192,7 +195,9 @@ export async function serializeCellValue({
return (data || []).map( return (data || []).map(
(attachment) => (attachment) =>
`${encodeURI(attachment.title)}(${encodeURI(attachment.url)})` `${encodeURI(attachment.title)}(${encodeURI(
attachment.path ? `${siteUrl}/${attachment.path}` : attachment.url
)})`
); );
} }
case UITypes.Lookup: case UITypes.Lookup:
@ -205,6 +210,7 @@ export async function serializeCellValue({
serializeCellValue({ serializeCellValue({
value: v, value: v,
column: lookupColumn, column: lookupColumn,
siteUrl,
}) })
) )
) )

Loading…
Cancel
Save