ezyang / htmlpurifier

Standards compliant HTML filter written in PHP
http://htmlpurifier.org
GNU Lesser General Public License v2.1
3.02k stars 323 forks source link

Adding additional protocol handlers to URI.AllowedSchemes #374

Open iainhenderson opened 1 year ago

iainhenderson commented 1 year ago

It looks like a few fairly popular protocol handlers are being stripped out by purifier. Could URI.AllowedSchemes be extended to allow options for:

pyres01 commented 1 year ago

邮件已收到,谢谢!

maxfenton commented 4 months ago

Yeah, we need sms: in our HTMLPurifier configs

ezyang commented 4 months ago

ok, send a pr

maxfenton commented 3 months ago

@ezyang What permissions would I need to add a PR?

I have a feature branch that duplicates the tel: tests for sms: in:

and essentially duplicates library/HTMLPurifier/URIScheme/tel.php as library/HTMLPurifier/URIScheme/sms.php with the class name HTMLPurifier_URIScheme_sms and the header comment:

/**
 * Validates sms (for text messaging).
 *
 * The relevant specification for this protocol is RFC 5724,
 * but this class normalizes phone numbers like HTMLPurifier_URIScheme_tel
 * so that they only include (possibly) a leading plus, and then any
 * number of digits and x'es.
 * 
 * Note this does not yet handle the full test case of:
 * href="sms:+19999999999?&body=Hello%2520I%252C%2520have%2527a%2520question%25"
 */

I might be missing an addition needed to URI.AllowedSchemes

pyres01 commented 3 months ago

邮件已收到,谢谢!

ezyang commented 3 months ago

Just open a PR from a branch on your fork