URL

Path: /src/type/url.coffee compiled to /lib/type/url.js

Checking text for a valid URL.

Sanitize options:

  • toAbsoluteBase - String convert to absolute with given base
  • removeQuery - Boolean remove query and hash from url

Check options:

  • hostsAllowed - String|RegExp list of allowed hosts by string or regexp
  • hostsDenied - String|RegExp list of denied hosts by string or regexp
  • allowProtocols - Array lust of allowed protocols
  • allowRelative - Boolean to allow also relative urls

Schema Specification

URL is an url schema definition.

An object with the following keys allowed: toAbsoluteBase, removeQuery, hostsAllowed, hostsDenied, allowProtocols, allowRelative, title, description, key, type, optional, default. The following entries have a specific format:

toAbsoluteBase

Absolute is the base URL to make it absolute.

A valid url (unified resource locator) which is optional. Relative URLs are also allowed.

removeQuery

Remove Query is a flag if set to true will remove the query string part.

A boolean value, which will be true for ‘true’, ‘1’, ‘on’, ‘yes’, ‘+’, 1, true and will be considered as false for ‘false’, ‘0’, ‘off’, ‘no’, ‘-’, 0, false. It’s optional.

hostsAllowed

Allowed Hosts are the hosts allowed in the URL (white list).

It has to be one of the following types (optional):

  • Allowed Hosts List is a list of all allowed hosts.

    A list. At least 1 elements should be given. Each entry has to be of type hostname:

    Allowed Host is an allowed host name.

    A valid hostname. This has to be a valid name according to RFC 1123 - Valid Hosts Match is a regular expression for valid hosts.

    A valid regular expression. It has to be one of the following types:

    • An object which has to be an instance of class RegExp.
    • A text entry in which all control characters will be removed. The text should match: /^/.?/[gim]$/.
hostsDenied

Disallowed Hosts are the hosts disallowed in the URL (black list).

It has to be one of the following types (optional):

  • Disallowed Hosts List is a list of all disallowed hosts.

    A list. At least 1 elements should be given. Each entry has to be of type hostname:

    Disallowed Host is a disallowed host name.

    A valid hostname. This has to be a valid name according to RFC 1123 - Invalid Hosts Match is a regular expression for invalid hosts.

    A valid regular expression. It has to be one of the following types:

    • An object which has to be an instance of class RegExp.
    • A text entry in which all control characters will be removed. The text should match: /^/.?/[gim]$/.
allowProtocols

Allowed Protocols are a list of allowed protocols.

A list which is optional. At least 1 elements should be given.

allowRelative

Allow Relative URL is a flag if set to true will also allow relative URLs.

A boolean value, which will be true for ‘true’, ‘1’, ‘on’, ‘yes’, ‘+’, 1, true and will be considered as false for ‘false’, ‘0’, ‘off’, ‘no’, ‘-’, 0, false. It’s optional.

title

Title is the title used to describe the element.

A text entry which is optional. All control characters will be removed.

description

Description is the free description of the element.

A text entry which is optional. All control characters will be removed.

key

Binding to Keyname is the mapping to which key names in an object this element belongs.

A valid regular expression which is optional. It has to be one of the following types:

  • An object which has to be an instance of class RegExp.
  • A text entry in which all control characters will be removed. The text should match: /^/.?/[gim]$/.
type

Type is the type of element.

A text entry in which all control characters will be removed.

optional

Optional is a flag defining if this element is optional.

A boolean value, which will be true for ‘true’, ‘1’, ‘on’, ‘yes’, ‘+’, 1, true and will be considered as false for ‘false’, ‘0’, ‘off’, ‘no’, ‘-’, 0, false. It’s optional.

default

Default Value is the default value to use if nothing given.

A valid url (unified resource locator) which is optional.