fix: encodes upload filename urls (#10048)
### What? Previously, upload files urls were not being encoded. ### Why? As a result, this could lead to discrepancies where upload filenames with spaces - the spaces would not be encoded as %20 in the URL. ### How? To address this issue, we simply need to encode the filename of the upload media. Fixes #9698
This commit is contained in:
@@ -12,7 +12,7 @@ type GenerateURLArgs = {
|
||||
}
|
||||
const generateURL = ({ collectionSlug, config, filename }: GenerateURLArgs) => {
|
||||
if (filename) {
|
||||
return `${config.serverURL || ''}${config.routes.api || ''}/${collectionSlug}/file/${filename}`
|
||||
return `${config.serverURL || ''}${config.routes.api || ''}/${collectionSlug}/file/${encodeURIComponent(filename)}`
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user