Merge branch 'spectrum-bbui-table' of github.com:Budibase/budibase into spectrum-bbui-table
This commit is contained in:
commit
fa60089bae
File diff suppressed because it is too large
Load Diff
|
@ -51,11 +51,11 @@ exports.prepareUpload = async function({ s3Key, bucket, metadata, file }) {
|
||||||
type: file.type,
|
type: file.type,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// don't store a URL, work this out on the way out as the URL could change
|
||||||
return {
|
return {
|
||||||
size: file.size,
|
size: file.size,
|
||||||
name: file.name,
|
name: file.name,
|
||||||
extension: [...file.name.split(".")].pop(),
|
extension: [...file.name.split(".")].pop(),
|
||||||
url: response.Location,
|
|
||||||
key: response.Key,
|
key: response.Key,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
const env = require("../environment")
|
const { ObjectStoreBuckets } = require("../constants")
|
||||||
const { OBJ_STORE_DIRECTORY } = require("../constants")
|
|
||||||
const linkRows = require("../db/linkedRows")
|
const linkRows = require("../db/linkedRows")
|
||||||
const { cloneDeep } = require("lodash/fp")
|
const { cloneDeep } = require("lodash/fp")
|
||||||
const { FieldTypes, AutoFieldSubTypes } = require("../constants")
|
const { FieldTypes, AutoFieldSubTypes } = require("../constants")
|
||||||
|
const { checkSlashesInUrl } = require("./index")
|
||||||
|
|
||||||
const BASE_AUTO_ID = 1
|
const BASE_AUTO_ID = 1
|
||||||
|
|
||||||
|
@ -180,18 +180,17 @@ exports.outputProcessing = async (appId, table, rows) => {
|
||||||
rows
|
rows
|
||||||
)
|
)
|
||||||
// update the attachments URL depending on hosting
|
// update the attachments URL depending on hosting
|
||||||
if (env.isProd() && env.SELF_HOSTED) {
|
for (let [property, column] of Object.entries(table.schema)) {
|
||||||
for (let [property, column] of Object.entries(table.schema)) {
|
if (column.type === FieldTypes.ATTACHMENT) {
|
||||||
if (column.type === FieldTypes.ATTACHMENT) {
|
for (let row of outputRows) {
|
||||||
for (let row of outputRows) {
|
if (row[property] == null || row[property].length === 0) {
|
||||||
if (row[property] == null || row[property].length === 0) {
|
continue
|
||||||
continue
|
|
||||||
}
|
|
||||||
row[property].forEach(attachment => {
|
|
||||||
attachment.url = `${OBJ_STORE_DIRECTORY}/${appId}/${attachment.url}`
|
|
||||||
attachment.url = attachment.url.replace("//", "/")
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
row[property].forEach(attachment => {
|
||||||
|
attachment.url = checkSlashesInUrl(
|
||||||
|
`${ObjectStoreBuckets.APPS}/${attachment.key}`
|
||||||
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue