Skip to content

Schemes list is very incomplete #62

@skalee

Description

@skalee

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:

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions