File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -529,6 +529,20 @@ public function send_headers_force( $buffer ) {
529529 // Hook to modify buffer after
530530 $ buffer = apply_filters ( 'litespeed_buffer_after ' , $ buffer );
531531
532+ // Make sure ESI links are decoded in situation where links are changed by block editor, in render function with wptexturize. Ticket #485348.
533+ if ( preg_match_all ( '/(<esi.+src=[" \'])(.*)([" \'].*\/>)/mU ' , $ buffer , $ matches_esi ) ) {
534+ foreach ( $ matches_esi [2 ] as $ index => $ match ) {
535+ // entity decode needs changes. For example: if finds & %2B %3D
536+ $ data = htmlspecialchars_decode ($ match );
537+
538+ if ( $ data !== $ match ) {
539+ $ pre_url = $ matches_esi [1 ][$ index ];
540+ $ post_url = $ matches_esi [3 ][$ index ];
541+ $ buffer = str_replace ( $ pre_url . $ match . $ post_url , $ pre_url . $ data . $ post_url , $ buffer );
542+ }
543+ }
544+ }
545+
532546 Debug2::ended ();
533547
534548 return $ buffer ;
You can’t perform that action at this time.
0 commit comments