Improve external media removal in style blocks
| @@ -463,6 +463,7 @@ export function encodeStyleTags(text) { | ||
| 463 | 463 | */ |
| 464 | 464 | export function decodeStyleTags(text) { |
| 465 | 465 | const styleDecodeRegex = /<custom-style>(.+?)<\/custom-style>/gms; |
| 466 | + const mediaAllowed = isExternalMediaAllowed(); | |
| 466 | 467 | |
| 467 | 468 | return text.replaceAll(styleDecodeRegex, (_, style) => { |
| 468 | 469 | try { |
| @@ -491,6 +492,13 @@ export function decodeStyleTags(text) { | ||
| 491 | 492 | } |
| 492 | 493 | } |
| 493 | 494 | } |
| 495 | + if (!mediaAllowed && Array.isArray(rule.declarations) && rule.declarations.length > 0) { | |
| 496 | + for (const declaration of rule.declarations) { | |
| 497 | + if (declaration.value.includes('://')) { | |
| 498 | + rule.declarations.splice(rule.declarations.indexOf(declaration), 1); | |
| 499 | + } | |
| 500 | + } | |
| 501 | + } | |
| 494 | 502 | } |
| 495 | 503 | } |
| 496 | 504 | } |