Skip to content
This repository has been archived by the owner on Aug 3, 2024. It is now read-only.

Fix bug with wsrv #1239

Merged
merged 2 commits into from
Aug 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion helpers/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ export const configuredXss = new xss.FilterXSS({
try {
const url = new URL(value)

if (url.hostname.includes('wsrv.nl')) {
url.searchParams.delete('errorredirect')
}

const allowedHostnames = [
'imgur.com',
'i.imgur.com',
Expand All @@ -88,9 +92,11 @@ export const configuredXss = new xss.FilterXSS({
return xss.safeAttrValue(
tag,
name,
`https://wsrv.nl/?url=${encodeURIComponent(value)}&n=-1`,
`https://wsrv.nl/?url=${encodeURIComponent(url.toString())}&n=-1`,
cssFilter
)
} else {
return xss.safeAttrValue(tag, name, url.toString(), cssFilter)
}
} catch (err) {}
}
Expand Down
Loading