summaryrefslogtreecommitdiff
path: root/vendor/github.com
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-03-27 15:59:57 +0200
committerLibravatar GitHub <noreply@github.com>2023-03-27 15:59:57 +0200
commit9e1756ce8b0986132ff077813be23bb45a7c9db7 (patch)
treec4a4082a0571753a3b55a3e4977ef0123549dd0f /vendor/github.com
parent[chore] License sloth logo + default avatars under CC by-sa 4.0 (#1651) (diff)
downloadgotosocial-9e1756ce8b0986132ff077813be23bb45a7c9db7.tar.xz
[chore]: Bump github.com/tdewolff/minify/v2 from 2.12.4 to 2.12.5 (#1649)
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.12.4 to 2.12.5. - [Release notes](https://github.com/tdewolff/minify/releases) - [Commits](https://github.com/tdewolff/minify/compare/v2.12.4...v2.12.5) --- updated-dependencies: - dependency-name: github.com/tdewolff/minify/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com')
-rw-r--r--vendor/github.com/tdewolff/minify/v2/README.md2
-rw-r--r--vendor/github.com/tdewolff/minify/v2/common.go15
-rw-r--r--vendor/github.com/tdewolff/minify/v2/html/html.go7
-rw-r--r--vendor/github.com/tdewolff/minify/v2/html/table.go8
-rw-r--r--vendor/github.com/tdewolff/parse/v2/util.go7
5 files changed, 22 insertions, 17 deletions
diff --git a/vendor/github.com/tdewolff/minify/v2/README.md b/vendor/github.com/tdewolff/minify/v2/README.md
index d2bfff407..39076140a 100644
--- a/vendor/github.com/tdewolff/minify/v2/README.md
+++ b/vendor/github.com/tdewolff/minify/v2/README.md
@@ -8,6 +8,8 @@
**[JavaScript bindings](https://www.npmjs.com/package/@tdewolff/minify)** install with `npm i @tdewolff/minify`
+**[.NET bindings](https://github.com/JKamsker/NMinify)** install with `Install-Package NMinify` or `dotnet add package NMinify`, thanks to Jonas Kamsker for the port
+
---
*Did you know that the shortest valid piece of HTML5 is `<!doctype html><title>x</title>`? See for yourself at the [W3C Validator](http://validator.w3.org/)!*
diff --git a/vendor/github.com/tdewolff/minify/v2/common.go b/vendor/github.com/tdewolff/minify/v2/common.go
index 67dc0d121..df0580047 100644
--- a/vendor/github.com/tdewolff/minify/v2/common.go
+++ b/vendor/github.com/tdewolff/minify/v2/common.go
@@ -18,11 +18,11 @@ var (
// Epsilon is the closest number to zero that is not considered to be zero.
var Epsilon = 0.00001
-// Mediatype minifies a given mediatype by removing all whitespace.
+// Mediatype minifies a given mediatype by removing all whitespace and lowercasing all parts except strings (which may be case sensitive).
func Mediatype(b []byte) []byte {
j := 0
- start := 0
inString := false
+ start, lastString := 0, 0
for i, c := range b {
if !inString && parse.IsWhitespace(c) {
if start != 0 {
@@ -33,13 +33,20 @@ func Mediatype(b []byte) []byte {
start = i + 1
} else if c == '"' {
inString = !inString
+ if inString {
+ parse.ToLower(b[lastString:i])
+ } else {
+ lastString = j + (i + 1 - start)
+ }
}
}
if start != 0 {
j += copy(b[j:], b[start:])
- return parse.ToLower(b[:j])
+ parse.ToLower(b[lastString:j])
+ return b[:j]
}
- return parse.ToLower(b)
+ parse.ToLower(b[lastString:])
+ return b
}
// DataURI minifies a data URI and calls a minifier by the specified mediatype. Specifications: https://www.ietf.org/rfc/rfc2397.txt.
diff --git a/vendor/github.com/tdewolff/minify/v2/html/html.go b/vendor/github.com/tdewolff/minify/v2/html/html.go
index 3431ad3be..616a9ba5a 100644
--- a/vendor/github.com/tdewolff/minify/v2/html/html.go
+++ b/vendor/github.com/tdewolff/minify/v2/html/html.go
@@ -392,14 +392,15 @@ func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, _ map[string]st
}
if attr.Traits&caselessAttr != 0 {
val = parse.ToLower(val)
- if attr.Hash == Enctype || attr.Hash == Codetype || attr.Hash == Accept || attr.Hash == Type && (t.Hash == A || t.Hash == Link || t.Hash == Embed || t.Hash == Object || t.Hash == Source || t.Hash == Script || t.Hash == Style) {
- val = minify.Mediatype(val)
- }
}
if rawTagHash != 0 && attr.Hash == Type {
rawTagMediatype = parse.Copy(val)
}
+ if attr.Hash == Enctype || attr.Hash == Codetype || attr.Hash == Accept || attr.Hash == Type && (t.Hash == A || t.Hash == Link || t.Hash == Embed || t.Hash == Object || t.Hash == Source || t.Hash == Script || t.Hash == Style) {
+ val = minify.Mediatype(val)
+ }
+
// default attribute values can be omitted
if !o.KeepDefaultAttrVals && (attr.Hash == Type && (t.Hash == Script && jsMimetypes[string(val)] ||
t.Hash == Style && bytes.Equal(val, cssMimeBytes) ||
diff --git a/vendor/github.com/tdewolff/minify/v2/html/table.go b/vendor/github.com/tdewolff/minify/v2/html/table.go
index 1ace143a5..7dd5ae6b7 100644
--- a/vendor/github.com/tdewolff/minify/v2/html/table.go
+++ b/vendor/github.com/tdewolff/minify/v2/html/table.go
@@ -137,7 +137,7 @@ var tagMap = map[Hash]traits{
}
var attrMap = map[Hash]traits{
- Accept: caselessAttr,
+ Accept: trimAttr,
Accept_Charset: caselessAttr,
Action: urlAttr,
Align: caselessAttr,
@@ -156,7 +156,7 @@ var attrMap = map[Hash]traits{
Classid: urlAttr,
Clear: caselessAttr,
Codebase: urlAttr,
- Codetype: caselessAttr,
+ Codetype: trimAttr,
Color: caselessAttr,
Cols: trimAttr,
Colspan: trimAttr,
@@ -172,7 +172,7 @@ var attrMap = map[Hash]traits{
Dir: caselessAttr,
Disabled: booleanAttr,
Enabled: booleanAttr,
- Enctype: caselessAttr,
+ Enctype: trimAttr,
Face: caselessAttr,
Formaction: urlAttr,
Formnovalidate: booleanAttr,
@@ -228,7 +228,7 @@ var attrMap = map[Hash]traits{
Text: caselessAttr,
Translate: caselessAttr,
Truespeed: booleanAttr,
- Type: caselessAttr,
+ Type: trimAttr,
Typemustmatch: booleanAttr,
Undeterminate: booleanAttr,
Usemap: urlAttr,
diff --git a/vendor/github.com/tdewolff/parse/v2/util.go b/vendor/github.com/tdewolff/parse/v2/util.go
index 4174cb242..db706d402 100644
--- a/vendor/github.com/tdewolff/parse/v2/util.go
+++ b/vendor/github.com/tdewolff/parse/v2/util.go
@@ -280,12 +280,7 @@ func replaceEntities(b []byte, i int, entitiesMap map[string][]byte, revEntities
} else if r[0] == '&' {
// check if for example &amp; is followed by something that could potentially be an entity
k := j + 1
- if k < len(b) && b[k] == '#' {
- k++
- }
- for ; k < len(b) && k-j <= MaxEntityLength && (b[k] >= '0' && b[k] <= '9' || b[k] >= 'a' && b[k] <= 'z' || b[k] >= 'A' && b[k] <= 'Z'); k++ {
- }
- if k < len(b) && b[k] == ';' {
+ if k < len(b) && (b[k] >= '0' && b[k] <= '9' || b[k] >= 'a' && b[k] <= 'z' || b[k] >= 'A' && b[k] <= 'Z' || b[k] == '#') {
return b, k
}
}