[web] disable filestore writes (#23470)
GitOrigin-RevId: 96ccd9205f9bf21420e67aaa68f8bc035eeb87d8
This commit is contained in:
@@ -130,6 +130,12 @@ const FileStoreHandler = {
|
||||
|
||||
const fileRef = new File(fileArgs)
|
||||
const fileId = fileRef._id
|
||||
const url = FileStoreHandler._buildUrl(projectId, fileId)
|
||||
|
||||
if (!Features.hasFeature('filestore')) {
|
||||
return callbackOnce(null, { url, fileRef })
|
||||
}
|
||||
|
||||
const readStream = fs.createReadStream(fsPath)
|
||||
readStream.on('error', function (err) {
|
||||
logger.warn(
|
||||
@@ -139,7 +145,6 @@ const FileStoreHandler = {
|
||||
callbackOnce(err)
|
||||
})
|
||||
readStream.on('open', function () {
|
||||
const url = FileStoreHandler._buildUrl(projectId, fileId)
|
||||
const opts = {
|
||||
method: 'post',
|
||||
uri: url,
|
||||
|
||||
@@ -213,8 +213,8 @@ async function _copyFiles(sourceEntries, sourceProject, targetProject) {
|
||||
file.hash = sourceFile.hash
|
||||
}
|
||||
let createdBlob = false
|
||||
const usingFilestore = Features.hasFeature('filestore')
|
||||
if (file.hash != null && Features.hasFeature('project-history-blobs')) {
|
||||
const usingFilestore = Features.hasFeature('filestore')
|
||||
try {
|
||||
await HistoryManager.promises.copyBlob(
|
||||
sourceHistoryId,
|
||||
@@ -250,6 +250,12 @@ async function _copyFiles(sourceEntries, sourceProject, targetProject) {
|
||||
if (createdBlob && Features.hasFeature('project-history-blobs')) {
|
||||
return { createdBlob, file, path, url: null }
|
||||
}
|
||||
if (!usingFilestore) {
|
||||
// Note: This is also checked in app.mjs
|
||||
throw new OError(
|
||||
'bad config: need to enable either filestore or project-history-blobs'
|
||||
)
|
||||
}
|
||||
const url = await FileStoreHandler.promises.copyFile(
|
||||
sourceProject._id,
|
||||
sourceFile._id,
|
||||
|
||||
Reference in New Issue
Block a user