overleaf-cep/services/web/frontend/js/features/utils/fileUrl.js
Brian Gough 2ce82fabab Merge pull request #22533 from overleaf/ar-only-use-history-for-blobs-when-enabled
[web] only use history for blobs when enabled

GitOrigin-RevId: 010983e9b29657d4c594e03945dca5700577bf0a
2025-01-10 09:05:32 +00:00

14 lines
479 B
JavaScript

// Helper function to compute the url for a file in history-v1 or filestore.
// This will be obsolete when the migration to history-v1 is complete.
import getMeta from '@/utils/meta'
const projectHistoryBlobsEnabled = getMeta('ol-projectHistoryBlobsEnabled')
export function fileUrl(projectId, id, hash) {
if (projectHistoryBlobsEnabled && hash) {
return `/project/${projectId}/blob/${hash}?fallback=${id}`
} else {
return `/project/${projectId}/file/${id}`
}
}