mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-11 15:10:48 +02:00
81f0807fc6
* [web] prepare filestore migration for Server Pro/CE * [history-v1] remove unused USER_FILES_BUCKET_NAME env var from script * [server-ce] tests: write default docker-compose.override.yml on startup * [server-ce] tests: extend access logging of host-admin for response * [server-ce] tests: test text and binary file upload * [server-ce] tests: add tests for filestore migration * [web] simplify feature gate for filestore/project-history-blobs logic Co-authored-by: Brian Gough <brian.gough@overleaf.com> * [server-ce] test: fix flaky test helper --------- Co-authored-by: Brian Gough <brian.gough@overleaf.com> GitOrigin-RevId: f89bdab2749e2b7a49d609e2eac6bf621c727966
22 lines
798 B
JavaScript
22 lines
798 B
JavaScript
// Pass settings to enable consistent unit tests from .js and .mjs modules
|
|
function projectHistoryURLWithFilestoreFallback(
|
|
Settings,
|
|
projectId,
|
|
historyId,
|
|
fileRef,
|
|
origin
|
|
) {
|
|
const filestoreURL = `${Settings.apis.filestore.url}/project/${projectId}/file/${fileRef._id}?from=${origin}`
|
|
// TODO: When this file is converted to ES modules we will be able to use Features.hasFeature('project-history-blobs'). Currently we can't stub the feature return value in tests.
|
|
if (fileRef.hash && Settings.filestoreMigrationLevel >= 1) {
|
|
return {
|
|
url: `${Settings.apis.project_history.url}/project/${historyId}/blob/${fileRef.hash}`,
|
|
fallbackURL: filestoreURL,
|
|
}
|
|
} else {
|
|
return { url: filestoreURL }
|
|
}
|
|
}
|
|
|
|
module.exports = { projectHistoryURLWithFilestoreFallback }
|