File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -138,9 +138,11 @@ public static function mergeUrlWithPath($url, $path): string
138138 */
139139 public static function sanitizeUrl (string $ url ): string
140140 {
141+ $ originalUrl = $ url ;
141142 // HTML decode the entities, then strip out any tags
142143 $ url = html_entity_decode ($ url , ENT_NOQUOTES , 'UTF-8 ' );
143144 $ url = urldecode ($ url );
145+ $ decodedUrl = $ url ;
144146 $ url = strip_tags ($ url );
145147 // Remove any Twig tags that somehow are present in the incoming URL
146148 /** @noinspection CallableParameterUseCaseInTypeContextInspection */
@@ -153,7 +155,10 @@ public static function sanitizeUrl(string $url): string
153155 ]
154156 , '' , $ url
155157 );
156-
158+ // If the URL didn't have anything stripped from it, us the original encoded URL
159+ if ($ url === $ decodedUrl ) {
160+ $ url = $ originalUrl ;
161+ }
157162 return $ url ;
158163 }
159164}
You can’t perform that action at this time.
0 commit comments