0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-11-08 14:58:42 +00:00

feat: Allows commas to be included in tel URI (#389)

* Allows commas in tel URI scheme validator (addresses #388)

* Adds comment explaining 8429f7b
This commit is contained in:
danbrellis 2023-11-10 10:25:42 -05:00 committed by GitHub
parent ab21ea735a
commit ec92490139
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,9 +33,9 @@ class HTMLPurifier_URIScheme_tel extends HTMLPurifier_URIScheme
$uri->host = null; $uri->host = null;
$uri->port = null; $uri->port = null;
// Delete all non-numeric characters, non-x characters // Delete all non-numeric characters, commas, and non-x characters
// from phone number, EXCEPT for a leading plus sign. // from phone number, EXCEPT for a leading plus sign.
$uri->path = preg_replace('/(?!^\+)[^\dx]/', '', $uri->path = preg_replace('/(?!^\+)[^\dx,]/', '',
// Normalize e(x)tension to lower-case // Normalize e(x)tension to lower-case
str_replace('X', 'x', rawurldecode($uri->path))); str_replace('X', 'x', rawurldecode($uri->path)));