File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
plugins/optimization-detective Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -325,19 +325,17 @@ function ( $image_candidate ) {
325
325
*
326
326
* @since n.e.x.t
327
327
*
328
- * @param string $url URL to percent encode. Any existing percent encodings will first be decoded.
328
+ * @param string $url URL to percent encode.
329
329
* @return string Percent-encoded URL.
330
330
*/
331
331
private function encode_url_for_response_header ( string $ url ): string {
332
- $ decoded_url = urldecode ( $ url );
333
-
334
332
// Encode characters not allowed in a URL per RFC 3986 (anything that is not among the reserved and unreserved characters).
335
333
$ encoded_url = (string ) preg_replace_callback (
336
- '/[^A-Za-z0-9\-._~:\/?#\[\]@!$& \'()*+,;=]/ ' ,
334
+ '/[^A-Za-z0-9\-._~:\/?#\[\]@!$& \'()*+,;=% ]/ ' ,
337
335
static function ( $ matches ) {
338
336
return rawurlencode ( $ matches [0 ] );
339
337
},
340
- $ decoded_url
338
+ $ url
341
339
);
342
340
return esc_url_raw ( $ encoded_url );
343
341
}
You can’t perform that action at this time.
0 commit comments