diff options
author | Wim <wim@42.be> | 2022-09-05 21:00:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-05 21:00:54 +0200 |
commit | fda05f22629156cc2eae130b501ebced2261ab42 (patch) | |
tree | b9761fb5202ab476b11c1136a5bea69df0dd0f83 /vendor/github.com/gomarkdown/markdown/internal | |
parent | 7abf1a5884bfba9ac19df26495924d86613874f3 (diff) | |
download | matterbridge-msglm-fda05f22629156cc2eae130b501ebced2261ab42.tar.gz matterbridge-msglm-fda05f22629156cc2eae130b501ebced2261ab42.tar.bz2 matterbridge-msglm-fda05f22629156cc2eae130b501ebced2261ab42.zip |
Update dependencies and fix whatsmeow API changes (#1887)
* Update dependencies
* Fix whatsmau API changes
Diffstat (limited to 'vendor/github.com/gomarkdown/markdown/internal')
-rw-r--r-- | vendor/github.com/gomarkdown/markdown/internal/valid/valid.go | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/vendor/github.com/gomarkdown/markdown/internal/valid/valid.go b/vendor/github.com/gomarkdown/markdown/internal/valid/valid.go deleted file mode 100644 index 9b3de3ec..00000000 --- a/vendor/github.com/gomarkdown/markdown/internal/valid/valid.go +++ /dev/null @@ -1,59 +0,0 @@ -package valid - -import ( - "bytes" -) - -var URIs = [][]byte{ - []byte("http://"), - []byte("https://"), - []byte("ftp://"), - []byte("mailto:"), -} - -var Paths = [][]byte{ - []byte("/"), - []byte("./"), - []byte("../"), -} - -// TODO: documentation -func IsSafeURL(url []byte) bool { - nLink := len(url) - for _, path := range Paths { - nPath := len(path) - linkPrefix := url[:nPath] - if nLink >= nPath && bytes.Equal(linkPrefix, path) { - if nLink == nPath { - return true - } else if isAlnum(url[nPath]) { - return true - } - } - } - - for _, prefix := range URIs { - // TODO: handle unicode here - // case-insensitive prefix test - nPrefix := len(prefix) - if nLink > nPrefix { - linkPrefix := bytes.ToLower(url[:nPrefix]) - if bytes.Equal(linkPrefix, prefix) && isAlnum(url[nPrefix]) { - return true - } - } - } - - return false -} - -// isAlnum returns true if c is a digit or letter -// TODO: check when this is looking for ASCII alnum and when it should use unicode -func isAlnum(c byte) bool { - return (c >= '0' && c <= '9') || isLetter(c) -} - -// isLetter returns true if c is ascii letter -func isLetter(c byte) bool { - return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') -} |