-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
By default, the validator allows http and https URI schemes only. However, that can be overriden by setting option :scheme:
Post.validates :url, uri_format: { scheme: /some|schemes|regexp/ }
Post.validates :url, uri_format: { scheme: :all }The value :all stands for a predefined list of popular schemes:
uri_format_validator/lib/uri_format_validator/validators/uri_format_validator.rb
Lines 16 to 25 in 605d896
| SCHEMES = %w[ | |
| aaa aaas about acap acct cap cid coap coaps crid data dav dict dns | |
| example file ftp geo go gopher h323 http https iax icap im imap info ipp | |
| ipps iris iris.beep iris.lwz iris.xpc iris.xpcs jabber ldap mailto mid | |
| msrp msrps mtqp mupdate news nfs ni nih nntp opaquelocktoken pkcs11 pop | |
| pres reload rtsp rtsps rtspu service session shttp sieve sip sips sms | |
| snmp soap.beep soap.beeps stun stuns tag tel telnet tftp thismessage tip | |
| tn3270 turn turns tv urn vemmi vnc ws wss xcon xcon-userid xmlrpc.beep | |
| xmlrpc.beeps xmpp z39.50r z39.50s | |
| ].freeze |
However, this list isn't complete. For instance, it lacks ssh URI scheme (ssh://[email protected]:riboseinc/uri_format_validator.git). And I'm worried it's not the only missing one. Any good reason to maintain the schemes list at all, @ronaldtse?