diff options
author | 2023-03-27 15:59:57 +0200 | |
---|---|---|
committer | 2023-03-27 15:59:57 +0200 | |
commit | 9e1756ce8b0986132ff077813be23bb45a7c9db7 (patch) | |
tree | c4a4082a0571753a3b55a3e4977ef0123549dd0f /vendor/github.com/tdewolff/minify/v2/common.go | |
parent | [chore] License sloth logo + default avatars under CC by-sa 4.0 (#1651) (diff) | |
download | gotosocial-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/tdewolff/minify/v2/common.go')
-rw-r--r-- | vendor/github.com/tdewolff/minify/v2/common.go | 15 |
1 files changed, 11 insertions, 4 deletions
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. |