|
|
|
@ -1,8 +1,8 @@ |
|
|
|
const env = require("../environment") |
|
|
|
const { OBJ_STORE_DIRECTORY } = require("../constants") |
|
|
|
const { ObjectStoreBuckets } = require("../constants") |
|
|
|
const linkRows = require("../db/linkedRows") |
|
|
|
const { cloneDeep } = require("lodash/fp") |
|
|
|
const { FieldTypes, AutoFieldSubTypes } = require("../constants") |
|
|
|
const { checkSlashesInUrl } = require("./index") |
|
|
|
|
|
|
|
const BASE_AUTO_ID = 1 |
|
|
|
|
|
|
|
@ -180,18 +180,17 @@ exports.outputProcessing = async (appId, table, rows) => { |
|
|
|
rows |
|
|
|
) |
|
|
|
// update the attachments URL depending on hosting
|
|
|
|
if (env.isProd() && env.SELF_HOSTED) { |
|
|
|
for (let [property, column] of Object.entries(table.schema)) { |
|
|
|
if (column.type === FieldTypes.ATTACHMENT) { |
|
|
|
for (let row of outputRows) { |
|
|
|
if (row[property] == null || row[property].length === 0) { |
|
|
|
continue |
|
|
|
} |
|
|
|
row[property].forEach(attachment => { |
|
|
|
attachment.url = `${OBJ_STORE_DIRECTORY}/${appId}/${attachment.url}` |
|
|
|
attachment.url = attachment.url.replace("//", "/") |
|
|
|
}) |
|
|
|
for (let [property, column] of Object.entries(table.schema)) { |
|
|
|
if (column.type === FieldTypes.ATTACHMENT) { |
|
|
|
for (let row of outputRows) { |
|
|
|
if (row[property] == null || row[property].length === 0) { |
|
|
|
continue |
|
|
|
} |
|
|
|
row[property].forEach(attachment => { |
|
|
|
attachment.url = checkSlashesInUrl( |
|
|
|
`${ObjectStoreBuckets.APPS}/${attachment.key}` |
|
|
|
) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|