mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 17:32:25 -05:00
[chore]: Bump github.com/tdewolff/minify/v2 from 2.20.16 to 2.20.17 (#2661)
This commit is contained in:
parent
a314d2b539
commit
30f6e6c7fe
5 changed files with 14 additions and 18 deletions
2
vendor/github.com/tdewolff/minify/v2/html/html.go
generated
vendored
2
vendor/github.com/tdewolff/minify/v2/html/html.go
generated
vendored
|
|
@ -504,7 +504,7 @@ func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, _ map[string]st
|
|||
if 0 < len(attr.Data) && (attr.Data[len(attr.Data)-1] == '\'' || attr.Data[len(attr.Data)-1] == '"') {
|
||||
quote = attr.Data[len(attr.Data)-1]
|
||||
}
|
||||
val = html.EscapeAttrVal(&attrByteBuffer, val, quote, o.KeepQuotes, isXML)
|
||||
val = html.EscapeAttrVal(&attrByteBuffer, val, quote, o.KeepQuotes || isXML)
|
||||
w.Write(val)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
12
vendor/github.com/tdewolff/parse/v2/html/util.go
generated
vendored
12
vendor/github.com/tdewolff/parse/v2/html/util.go
generated
vendored
|
|
@ -6,7 +6,7 @@ var (
|
|||
)
|
||||
|
||||
// EscapeAttrVal returns the escaped attribute value bytes with quotes. Either single or double quotes are used, whichever is shorter. If there are no quotes present in the value and the value is in HTML (not XML), it will return the value without quotes.
|
||||
func EscapeAttrVal(buf *[]byte, b []byte, origQuote byte, mustQuote, isXML bool) []byte {
|
||||
func EscapeAttrVal(buf *[]byte, b []byte, origQuote byte, mustQuote bool) []byte {
|
||||
singles := 0
|
||||
doubles := 0
|
||||
unquoted := true
|
||||
|
|
@ -20,9 +20,9 @@ func EscapeAttrVal(buf *[]byte, b []byte, origQuote byte, mustQuote, isXML bool)
|
|||
}
|
||||
}
|
||||
}
|
||||
if unquoted && (!mustQuote || origQuote == 0) && !isXML {
|
||||
if unquoted && (!mustQuote || origQuote == 0) {
|
||||
return b
|
||||
} else if singles == 0 && origQuote == '\'' && !isXML || doubles == 0 && origQuote == '"' {
|
||||
} else if singles == 0 && origQuote == '\'' || doubles == 0 && origQuote == '"' {
|
||||
if len(b)+2 > cap(*buf) {
|
||||
*buf = make([]byte, 0, len(b)+2)
|
||||
}
|
||||
|
|
@ -36,14 +36,10 @@ func EscapeAttrVal(buf *[]byte, b []byte, origQuote byte, mustQuote, isXML bool)
|
|||
n := len(b) + 2
|
||||
var quote byte
|
||||
var escapedQuote []byte
|
||||
if singles >= doubles || isXML {
|
||||
if singles > doubles || singles == doubles && origQuote != '\'' {
|
||||
n += doubles * 4
|
||||
quote = '"'
|
||||
escapedQuote = doubleQuoteEntityBytes
|
||||
if singles == doubles && origQuote == '\'' && !isXML {
|
||||
quote = '\''
|
||||
escapedQuote = singleQuoteEntityBytes
|
||||
}
|
||||
} else {
|
||||
n += singles * 4
|
||||
quote = '\''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue