Skip to content

Commit

Permalink
fix: remove extra slash in download links
Browse files Browse the repository at this point in the history
  • Loading branch information
kabaros committed Aug 28, 2023
1 parent 692c949 commit 9d97f65
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/DownloadAs/use-hrefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ const useHrefs = ({ endpoint, fileTypes, queryStr }) => {
// based on query params, but older endpoints only take a timestamp
queryStr = queryStr || `t=${timestamp}`

// removing leading slash for endpoint to make sure it works whether it's configured with slash or not
const endpointUrl = `${baseUrl}/api/${apiVersion}/${endpoint?.replace(/^\//, '')}`

return fileTypes.reduce((acc, type) => {
const downloadUrl = `${baseUrl}/api/${apiVersion}/${endpoint}.${type}?${queryStr}`
const downloadUrl = `${endpointUrl}.${type}?${queryStr}`
acc[type] = downloadUrl
return acc
}, {})
Expand Down

0 comments on commit 9d97f65

Please sign in to comment.