Sanitize github svg download_url
This commit is contained in:
parent
0e03e256d0
commit
19baaa994b
1 changed files with 5 additions and 1 deletions
|
|
@ -34,7 +34,11 @@ const parseYaml = data => {
|
|||
|
||||
const replaceUploadUrls = (uploads = [], string) => {
|
||||
uploads.forEach(upload => {
|
||||
string = string.replace(upload.publicPath, upload.download_url)
|
||||
const url = new URL(upload.download_url)
|
||||
if (url.pathname.match(/.svg$/)) {
|
||||
url.search += (url.search.slice(1) === '' ? '?' : '&') + 'sanitize=true'
|
||||
}
|
||||
string = string.replace(upload.publicPath, url)
|
||||
})
|
||||
return string
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue