Documentation
¶
Overview ¶
Package weburl checks URLs that people store and other people's browsers load or follow: organization logos and websites, and avatars.
Index ¶
Constants ¶
const MaxLen = 2048
MaxLen is the longest URL accepted.
Variables ¶
var ErrNotHTTPS = errors.New("must be an absolute https URL")
ErrNotHTTPS is returned for a URL that is not an absolute https URL.
Functions ¶
func CheckHTTPS ¶
CheckHTTPS returns nil when raw is empty, which clears the field, or an absolute https URL with a host, no user info, no control characters and at most MaxLen bytes. Anything else, such as "javascript:", "data:" or "http:", returns ErrNotHTTPS: a stored URL is loaded or followed by every browser that shows it.
func HTTPSOrEmpty ¶
HTTPSOrEmpty returns raw when CheckHTTPS accepts it, and "" otherwise. Use it for values copied from an identity provider, where an unusable URL should be dropped rather than fail the sign-in.
Types ¶
This section is empty.