fileUrl.js 479 B

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