Merge pull request #15 from Jinksi/sha

Sanitize github svg download_url
This commit is contained in:
Eric Jinks 2018-02-16 16:07:19 +10:00 committed by GitHub
commit 2448891cb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
}