Merge branch 'spectrum-bbui-table' of github.com:Budibase/budibase into spectrum-bbui-table

This commit is contained in:
Andrew Kingston 2021-04-09 13:52:43 +01:00
commit 2b46f8bfbc
3 changed files with 11 additions and 5 deletions

View File

@ -5,6 +5,7 @@ const fetch = require("node-fetch")
const PouchDB = require("../../../db")
const CouchDB = require("pouchdb")
const { upload } = require("../../../utilities/fileSystem")
const { attachmentsRelativeURL } = require("../../../utilities")
// TODO: everything in this file is to be removed
@ -55,6 +56,7 @@ exports.prepareUpload = async function({ s3Key, bucket, metadata, file }) {
return {
size: file.size,
name: file.name,
url: attachmentsRelativeURL(response.Key),
extension: [...file.name.split(".")].pop(),
key: response.Key,
}

View File

@ -1,7 +1,7 @@
const env = require("../environment")
const { DocumentTypes, SEPARATOR } = require("../db/utils")
const CouchDB = require("../db")
const { OBJ_STORE_DIRECTORY } = require("../constants")
const { OBJ_STORE_DIRECTORY, ObjectStoreBuckets } = require("../constants")
const BB_CDN = "https://cdn.app.budi.live/assets"
const APP_PREFIX = DocumentTypes.APP + SEPARATOR
@ -157,3 +157,9 @@ exports.clientLibraryPath = appId => {
return `/api/assets/client`
}
}
exports.attachmentsRelativeURL = attachmentKey => {
return exports.checkSlashesInUrl(
`/${ObjectStoreBuckets.APPS}/${attachmentKey}`
)
}

View File

@ -2,7 +2,7 @@ const { ObjectStoreBuckets } = require("../constants")
const linkRows = require("../db/linkedRows")
const { cloneDeep } = require("lodash/fp")
const { FieldTypes, AutoFieldSubTypes } = require("../constants")
const { checkSlashesInUrl } = require("./index")
const { attachmentsRelativeURL } = require("./index")
const BASE_AUTO_ID = 1
@ -187,9 +187,7 @@ exports.outputProcessing = async (appId, table, rows) => {
continue
}
row[property].forEach(attachment => {
attachment.url = checkSlashesInUrl(
`${ObjectStoreBuckets.APPS}/${attachment.key}`
)
attachment.url = attachmentsRelativeURL(attachment.key)
})
}
}