diff --git a/src/core.cls.php b/src/core.cls.php index bd40ff0ff..01e9ac0f2 100644 --- a/src/core.cls.php +++ b/src/core.cls.php @@ -539,6 +539,23 @@ public function send_headers_force($buffer) // Hook to modify buffer after $buffer = apply_filters('litespeed_buffer_after', $buffer); + // Make sure ESI links are decoded in situation where links are changed by block editor, in render function with wptexturize. Ticket #485348. + if(preg_match_all('/()/mU', $buffer, $matchesEsi)){ + foreach($matchesEsi[2] as $index => $match){ + $data = $match; + // entity decode needs changes. For example: if finds & + if(preg_match('/&#(.+);/mU', $data) === 1){ + $data = html_entity_decode($data); + $data = rawurldecode($data); + } + + if($data !== $match){ + $pre_url = $matchesEsi[1][$index]; + $post_url = $matchesEsi[3][$index]; + $buffer = str_replace($pre_url.$match.$post_url, $pre_url.$data.$post_url, $buffer); + } + } + } Debug2::ended(); return $buffer;