mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 07:42:24 -06:00
[chore]: Bump github.com/yuin/goldmark from 1.5.4 to 1.5.5 (#2023)
This commit is contained in:
parent
c9f3539b5a
commit
b05f6c8f56
7 changed files with 35 additions and 20 deletions
16
vendor/github.com/yuin/goldmark/renderer/html/html.go
generated
vendored
16
vendor/github.com/yuin/goldmark/renderer/html/html.go
generated
vendored
|
|
@ -901,20 +901,24 @@ var bVb = []byte("vbscript:")
|
|||
var bFile = []byte("file:")
|
||||
var bData = []byte("data:")
|
||||
|
||||
func hasPrefix(s, prefix []byte) bool {
|
||||
return len(s) >= len(prefix) && bytes.Equal(bytes.ToLower(s[0:len(prefix)]), bytes.ToLower(prefix))
|
||||
}
|
||||
|
||||
// IsDangerousURL returns true if the given url seems a potentially dangerous url,
|
||||
// otherwise false.
|
||||
func IsDangerousURL(url []byte) bool {
|
||||
if bytes.HasPrefix(url, bDataImage) && len(url) >= 11 {
|
||||
if hasPrefix(url, bDataImage) && len(url) >= 11 {
|
||||
v := url[11:]
|
||||
if bytes.HasPrefix(v, bPng) || bytes.HasPrefix(v, bGif) ||
|
||||
bytes.HasPrefix(v, bJpeg) || bytes.HasPrefix(v, bWebp) ||
|
||||
bytes.HasPrefix(v, bSvg) {
|
||||
if hasPrefix(v, bPng) || hasPrefix(v, bGif) ||
|
||||
hasPrefix(v, bJpeg) || hasPrefix(v, bWebp) ||
|
||||
hasPrefix(v, bSvg) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
return bytes.HasPrefix(url, bJs) || bytes.HasPrefix(url, bVb) ||
|
||||
bytes.HasPrefix(url, bFile) || bytes.HasPrefix(url, bData)
|
||||
return hasPrefix(url, bJs) || hasPrefix(url, bVb) ||
|
||||
hasPrefix(url, bFile) || hasPrefix(url, bData)
|
||||
}
|
||||
|
||||
func nodeToHTMLText(n ast.Node, source []byte) []byte {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue