summaryrefslogtreecommitdiff
path: root/vendor/github.com/tdewolff/parse/v2/common.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2024-11-25 10:45:54 +0000
committerLibravatar GitHub <noreply@github.com>2024-11-25 10:45:54 +0000
commitae1a98558acf1ff74979954d8279f45a8ba3593a (patch)
tree631d5282674b788b8ce6c7e91bfb3649f2fb418a /vendor/github.com/tdewolff/parse/v2/common.go
parent[feature] Add domain permission drafts and excludes (#3547) (diff)
downloadgotosocial-ae1a98558acf1ff74979954d8279f45a8ba3593a.tar.xz
[chore]: Bump github.com/tdewolff/minify/v2 from 2.21.1 to 2.21.2 (#3567)
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.21.1 to 2.21.2. - [Release notes](https://github.com/tdewolff/minify/releases) - [Commits](https://github.com/tdewolff/minify/compare/v2.21.1...v2.21.2) --- 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/parse/v2/common.go')
-rw-r--r--vendor/github.com/tdewolff/parse/v2/common.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/vendor/github.com/tdewolff/parse/v2/common.go b/vendor/github.com/tdewolff/parse/v2/common.go
index e0795304c..1883d1bd4 100644
--- a/vendor/github.com/tdewolff/parse/v2/common.go
+++ b/vendor/github.com/tdewolff/parse/v2/common.go
@@ -317,9 +317,13 @@ func replaceEntities(b []byte, i int, entitiesMap map[string][]byte, revEntities
}
} else {
for ; j < len(b) && j-i-1 <= MaxEntityLength && b[j] != ';'; j++ {
+ if !(b[j] >= '0' && b[j] <= '9' || b[j] >= 'a' && b[j] <= 'z' || b[j] >= 'A' && b[j] <= 'Z') {
+ // invalid character reference character
+ break
+ }
}
- if j <= i+1 || len(b) <= j {
- return b, j - 1
+ if len(b) <= j || j == i+1 || b[j] != ';' {
+ return b, i
}
var ok bool
@@ -399,7 +403,7 @@ func ReplaceMultipleWhitespaceAndEntities(b []byte, entitiesMap map[string][]byt
if j == 0 {
return b
} else if j == 1 { // only if starts with whitespace
- b[k-1] = b[0]
+ b[k-1] = b[0] // move newline to end of whitespace
return b[k-1:]
} else if k < len(b) {
j += copy(b[j:], b[k:])