mirror of
https://github.com/modrinth/code.git
synced 2026-08-25 09:04:55 +00:00
fix: Gifs in the project description are not working properly (#7076)
* fix: Gifs in the project description are not working properly Fixes #3786 * prepr --------- Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
+4
-10
@@ -90,7 +90,7 @@ export const configuredXss = new FilterXSS({
|
||||
!value.startsWith('data:')
|
||||
) {
|
||||
try {
|
||||
const url = new URL(value)
|
||||
const url = new URL(value.replaceAll('&', '&'))
|
||||
|
||||
if (url.hostname.includes('wsrv.nl')) {
|
||||
url.searchParams.delete('errorredirect')
|
||||
@@ -124,16 +124,10 @@ export const configuredXss = new FilterXSS({
|
||||
!allowedHostnames.includes(url.hostname) &&
|
||||
!allowedHostnameSuffixes.some((suffix) => url.hostname.endsWith(suffix))
|
||||
) {
|
||||
return safeAttrValue(
|
||||
tag,
|
||||
name,
|
||||
`https://wsrv.nl/?url=${encodeURIComponent(
|
||||
url.toString().replaceAll('&', '&'),
|
||||
)}&n=-1`,
|
||||
cssFilter,
|
||||
)
|
||||
const proxiedUrl = `https://wsrv.nl/?url=${encodeURIComponent(url.toString())}&n=-1`
|
||||
return safeAttrValue(tag, name, proxiedUrl.replaceAll('&', '&'), cssFilter)
|
||||
}
|
||||
return safeAttrValue(tag, name, url.toString(), cssFilter)
|
||||
return safeAttrValue(tag, name, url.toString().replaceAll('&', '&'), cssFilter)
|
||||
} catch {
|
||||
/* empty */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user