2025-04-24 13:11:28 +08:00

15 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}`
}
}