From 7c19b2c0b9b094cef26964ece51c6fdae13f5929 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Apr 2023 15:08:52 +0000 Subject: [PATCH 01/22] Bump github.com/Masterminds/goutils from 1.1.0 to 1.1.1 in /server Bumps [github.com/Masterminds/goutils](https://github.com/Masterminds/goutils) from 1.1.0 to 1.1.1. - [Release notes](https://github.com/Masterminds/goutils/releases) - [Changelog](https://github.com/Masterminds/goutils/blob/master/CHANGELOG.md) - [Commits](https://github.com/Masterminds/goutils/compare/v1.1.0...v1.1.1) --- updated-dependencies: - dependency-name: github.com/Masterminds/goutils dependency-type: indirect ... Signed-off-by: dependabot[bot] --- server/go.mod | 4 +-- server/go.sum | 4 +-- .../goutils/cryptorandomstringutils.go | 25 ++----------------- .../Masterminds/goutils/randomstringutils.go | 24 ++---------------- .../Masterminds/goutils/stringutils.go | 16 ++++++++++++ server/vendor/modules.txt | 2 +- 6 files changed, 25 insertions(+), 50 deletions(-) diff --git a/server/go.mod b/server/go.mod index 57c7622e3..42cee949a 100644 --- a/server/go.mod +++ b/server/go.mod @@ -34,7 +34,7 @@ require ( github.com/go-chi/jwtauth v1.2.0 github.com/go-oauth2/oauth2/v4 v4.4.3 github.com/go-sql-driver/mysql v1.6.0 - github.com/golang-jwt/jwt/v4 v4.4.3 + github.com/golang-jwt/jwt/v4 v4.4.1 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.2 @@ -82,7 +82,7 @@ require ( require ( cloud.google.com/go v0.99.0 // indirect - github.com/Masterminds/goutils v1.1.0 // indirect + github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver v1.5.0 // indirect github.com/PaesslerAG/jsonpath v0.1.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect diff --git a/server/go.sum b/server/go.sum index 7d89db7b8..8a17a88ef 100644 --- a/server/go.sum +++ b/server/go.sum @@ -60,8 +60,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= -github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RPBiVg= -github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= +github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= diff --git a/server/vendor/github.com/Masterminds/goutils/cryptorandomstringutils.go b/server/vendor/github.com/Masterminds/goutils/cryptorandomstringutils.go index 177dd8658..8dbd92485 100644 --- a/server/vendor/github.com/Masterminds/goutils/cryptorandomstringutils.go +++ b/server/vendor/github.com/Masterminds/goutils/cryptorandomstringutils.go @@ -21,7 +21,6 @@ import ( "fmt" "math" "math/big" - "regexp" "unicode" ) @@ -99,27 +98,7 @@ Returns: error - an error stemming from an invalid parameter within underlying function, CryptoRandom(...) */ func CryptoRandomAlphaNumeric(count int) (string, error) { - if count == 0 { - return "", nil - } - RandomString, err := CryptoRandom(count, 0, 0, true, true) - if err != nil { - return "", fmt.Errorf("Error: %s", err) - } - match, err := regexp.MatchString("([0-9]+)", RandomString) - if err != nil { - panic(err) - } - - if !match { - //Get the position between 0 and the length of the string-1 to insert a random number - position := getCryptoRandomInt(count) - //Insert a random number between [0-9] in the position - RandomString = RandomString[:position] + string('0' + getCryptoRandomInt(10)) + RandomString[position + 1:] - return RandomString, err - } - return RandomString, err - + return CryptoRandom(count, 0, 0, true, true) } /* @@ -204,7 +183,7 @@ func CryptoRandom(count int, start int, end int, letters bool, numbers bool, cha if chars == nil { ch = rune(getCryptoRandomInt(gap) + int64(start)) } else { - ch = chars[getCryptoRandomInt(gap) + int64(start)] + ch = chars[getCryptoRandomInt(gap)+int64(start)] } if letters && unicode.IsLetter(ch) || numbers && unicode.IsDigit(ch) || !letters && !numbers { diff --git a/server/vendor/github.com/Masterminds/goutils/randomstringutils.go b/server/vendor/github.com/Masterminds/goutils/randomstringutils.go index 1364e0caf..272670231 100644 --- a/server/vendor/github.com/Masterminds/goutils/randomstringutils.go +++ b/server/vendor/github.com/Masterminds/goutils/randomstringutils.go @@ -20,7 +20,6 @@ import ( "fmt" "math" "math/rand" - "regexp" "time" "unicode" ) @@ -75,12 +74,10 @@ func RandomNumeric(count int) (string, error) { /* RandomAlphabetic creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of alpha-numeric characters as indicated by the arguments. +Characters will be chosen from the set of alphabetic characters. Parameters: count - the length of random string to create - letters - if true, generated string may include alphabetic characters - numbers - if true, generated string may include numeric characters Returns: string - the random string @@ -102,24 +99,7 @@ Returns: error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) */ func RandomAlphaNumeric(count int) (string, error) { - RandomString, err := Random(count, 0, 0, true, true) - if err != nil { - return "", fmt.Errorf("Error: %s", err) - } - match, err := regexp.MatchString("([0-9]+)", RandomString) - if err != nil { - panic(err) - } - - if !match { - //Get the position between 0 and the length of the string-1 to insert a random number - position := rand.Intn(count) - //Insert a random number between [0-9] in the position - RandomString = RandomString[:position] + string('0'+rand.Intn(10)) + RandomString[position+1:] - return RandomString, err - } - return RandomString, err - + return Random(count, 0, 0, true, true) } /* diff --git a/server/vendor/github.com/Masterminds/goutils/stringutils.go b/server/vendor/github.com/Masterminds/goutils/stringutils.go index 5037c4516..741bb530e 100644 --- a/server/vendor/github.com/Masterminds/goutils/stringutils.go +++ b/server/vendor/github.com/Masterminds/goutils/stringutils.go @@ -222,3 +222,19 @@ func IndexOf(str string, sub string, start int) int { func IsEmpty(str string) bool { return len(str) == 0 } + +// Returns either the passed in string, or if the string is empty, the value of defaultStr. +func DefaultString(str string, defaultStr string) string { + if IsEmpty(str) { + return defaultStr + } + return str +} + +// Returns either the passed in string, or if the string is whitespace, empty (""), the value of defaultStr. +func DefaultIfBlank(str string, defaultStr string) string { + if IsBlank(str) { + return defaultStr + } + return str +} diff --git a/server/vendor/modules.txt b/server/vendor/modules.txt index 89d8423ac..9aecb9a8f 100644 --- a/server/vendor/modules.txt +++ b/server/vendor/modules.txt @@ -7,7 +7,7 @@ github.com/766b/chi-prometheus # github.com/99designs/basicauth-go v0.0.0-20160802081356-2a93ba0f464d ## explicit github.com/99designs/basicauth-go -# github.com/Masterminds/goutils v1.1.0 +# github.com/Masterminds/goutils v1.1.1 ## explicit github.com/Masterminds/goutils # github.com/Masterminds/semver v1.5.0 From 364b7154b0d5ab3d589544159d3f411ef2157780 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Feb 2023 10:28:31 +0000 Subject: [PATCH 02/22] Bump minimist from 0.2.1 to 0.2.4 in /lib/vue Bumps [minimist](https://github.com/minimistjs/minimist) from 0.2.1 to 0.2.4. - [Release notes](https://github.com/minimistjs/minimist/releases) - [Changelog](https://github.com/minimistjs/minimist/blob/main/CHANGELOG.md) - [Commits](https://github.com/minimistjs/minimist/compare/v0.2.1...v0.2.4) --- updated-dependencies: - dependency-name: minimist dependency-type: indirect ... Signed-off-by: dependabot[bot] --- lib/vue/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/vue/yarn.lock b/lib/vue/yarn.lock index 9d6e2c33e..30c2a1a64 100644 --- a/lib/vue/yarn.lock +++ b/lib/vue/yarn.lock @@ -7018,9 +7018,9 @@ minimatch@^3.0.4: brace-expansion "^1.1.7" minimist@0.0.8, minimist@^0.2.1, minimist@^1.2.0, minimist@^1.2.5: - version "0.2.1" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.2.1.tgz#827ba4e7593464e7c221e8c5bed930904ee2c455" - integrity sha512-GY8fANSrTMfBVfInqJAY41QkOM+upUTytK1jZ0c8+3HdHrJxBJ3rF5i9moClXTE8uUSnUo8cAsCoxDXvSY4DHg== + version "0.2.4" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.2.4.tgz#0085d5501e29033748a2f2a4da0180142697a475" + integrity sha512-Pkrrm8NjyQ8yVt8Am9M+yUt74zE3iokhzbG1bFVNjLB92vwM71hf40RkEsryg98BujhVOncKm/C1xROxZ030LQ== minipass@^3.1.1: version "3.1.6" From ad81a62a1c39e2c0d82d89038a1197e90739540f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Feb 2023 10:28:32 +0000 Subject: [PATCH 03/22] Bump minimist from 1.2.5 to 1.2.8 in /client/web/privacy Bumps [minimist](https://github.com/minimistjs/minimist) from 1.2.5 to 1.2.8. - [Release notes](https://github.com/minimistjs/minimist/releases) - [Changelog](https://github.com/minimistjs/minimist/blob/main/CHANGELOG.md) - [Commits](https://github.com/minimistjs/minimist/compare/v1.2.5...v1.2.8) --- updated-dependencies: - dependency-name: minimist dependency-type: indirect ... Signed-off-by: dependabot[bot] --- client/web/privacy/yarn.lock | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/client/web/privacy/yarn.lock b/client/web/privacy/yarn.lock index 746d0ed85..253024d4d 100644 --- a/client/web/privacy/yarn.lock +++ b/client/web/privacy/yarn.lock @@ -7477,15 +7477,10 @@ minimist-options@^3.0.1: arrify "^1.0.1" is-plain-obj "^1.1.0" -minimist@^1.1.3, minimist@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" - integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== - -minimist@^1.2.0: - version "1.2.6" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" - integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== +minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5: + version "1.2.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" + integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== minipass@^3.1.1: version "3.1.6" From 5f0e58ce3d916c6af3ceb2fec86cdc6d31b298e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Apr 2023 10:33:07 +0000 Subject: [PATCH 04/22] Bump golang.org/x/net in /server Bumps [golang.org/x/net](https://github.com/golang/net) from 0.0.0-20220722155237-a158d28d115b to 0.7.0. - [Release notes](https://github.com/golang/net/releases) - [Commits](https://github.com/golang/net/commits/v0.7.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: indirect ... Signed-off-by: dependabot[bot] --- server/go.mod | 4 +- server/go.sum | 6 +- .../vendor/golang.org/x/net/context/go17.go | 4 +- server/vendor/golang.org/x/net/html/parse.go | 4 +- server/vendor/golang.org/x/net/html/render.go | 4 +- server/vendor/golang.org/x/net/html/token.go | 61 +- server/vendor/golang.org/x/net/http2/flow.go | 88 +- server/vendor/golang.org/x/net/http2/frame.go | 33 +- .../golang.org/x/net/http2/headermap.go | 18 + .../golang.org/x/net/http2/hpack/encode.go | 7 +- .../golang.org/x/net/http2/hpack/hpack.go | 97 +- .../x/net/http2/hpack/static_table.go | 188 + .../golang.org/x/net/http2/hpack/tables.go | 78 +- server/vendor/golang.org/x/net/http2/http2.go | 8 +- .../vendor/golang.org/x/net/http2/server.go | 331 +- .../golang.org/x/net/http2/transport.go | 321 +- .../x/net/publicsuffix/data/children | Bin 0 -> 2876 bytes .../golang.org/x/net/publicsuffix/data/nodes | Bin 0 -> 48280 bytes .../golang.org/x/net/publicsuffix/data/text | 1 + .../golang.org/x/net/publicsuffix/list.go | 27 +- .../golang.org/x/net/publicsuffix/table.go | 10567 +--------------- .../golang.org/x/net/trace/histogram.go | 2 +- server/vendor/golang.org/x/net/trace/trace.go | 2 +- server/vendor/golang.org/x/term/AUTHORS | 3 - server/vendor/golang.org/x/term/CONTRIBUTORS | 3 - server/vendor/golang.org/x/term/term.go | 10 +- server/vendor/golang.org/x/term/terminal.go | 3 +- server/vendor/modules.txt | 4 +- 28 files changed, 930 insertions(+), 10944 deletions(-) create mode 100644 server/vendor/golang.org/x/net/http2/hpack/static_table.go create mode 100644 server/vendor/golang.org/x/net/publicsuffix/data/children create mode 100644 server/vendor/golang.org/x/net/publicsuffix/data/nodes create mode 100644 server/vendor/golang.org/x/net/publicsuffix/data/text delete mode 100644 server/vendor/golang.org/x/term/AUTHORS delete mode 100644 server/vendor/golang.org/x/term/CONTRIBUTORS diff --git a/server/go.mod b/server/go.mod index 42cee949a..df50b53af 100644 --- a/server/go.mod +++ b/server/go.mod @@ -131,9 +131,9 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/valyala/fasthttp v1.35.0 // indirect go.uber.org/multierr v1.7.0 // indirect - golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect + golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect - golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect + golang.org/x/term v0.5.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect diff --git a/server/go.sum b/server/go.sum index 8a17a88ef..b5d8b7852 100644 --- a/server/go.sum +++ b/server/go.sum @@ -735,8 +735,9 @@ golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -841,8 +842,9 @@ golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/server/vendor/golang.org/x/net/context/go17.go b/server/vendor/golang.org/x/net/context/go17.go index 0a54bdbcc..2cb9c408f 100644 --- a/server/vendor/golang.org/x/net/context/go17.go +++ b/server/vendor/golang.org/x/net/context/go17.go @@ -32,7 +32,7 @@ var DeadlineExceeded = context.DeadlineExceeded // call cancel as soon as the operations running in this Context complete. func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { ctx, f := context.WithCancel(parent) - return ctx, CancelFunc(f) + return ctx, f } // WithDeadline returns a copy of the parent context with the deadline adjusted @@ -46,7 +46,7 @@ func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { // call cancel as soon as the operations running in this Context complete. func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) { ctx, f := context.WithDeadline(parent, deadline) - return ctx, CancelFunc(f) + return ctx, f } // WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)). diff --git a/server/vendor/golang.org/x/net/html/parse.go b/server/vendor/golang.org/x/net/html/parse.go index 038941d70..46a89eda6 100644 --- a/server/vendor/golang.org/x/net/html/parse.go +++ b/server/vendor/golang.org/x/net/html/parse.go @@ -184,7 +184,7 @@ func (p *parser) clearStackToContext(s scope) { } } -// parseGenericRawTextElements implements the generic raw text element parsing +// parseGenericRawTextElement implements the generic raw text element parsing // algorithm defined in 12.2.6.2. // https://html.spec.whatwg.org/multipage/parsing.html#parsing-elements-that-contain-only-text // TODO: Since both RAWTEXT and RCDATA states are treated as tokenizer's part @@ -734,7 +734,7 @@ func inHeadIM(p *parser) bool { return false } -// 12.2.6.4.5. +// Section 12.2.6.4.5. func inHeadNoscriptIM(p *parser) bool { switch p.tok.Type { case DoctypeToken: diff --git a/server/vendor/golang.org/x/net/html/render.go b/server/vendor/golang.org/x/net/html/render.go index b46d81ca6..497e13204 100644 --- a/server/vendor/golang.org/x/net/html/render.go +++ b/server/vendor/golang.org/x/net/html/render.go @@ -85,7 +85,7 @@ func render1(w writer, n *Node) error { if _, err := w.WriteString(""); err != nil { @@ -96,7 +96,7 @@ func render1(w writer, n *Node) error { if _, err := w.WriteString("" case CommentToken: - return "" + return "" case DoctypeToken: - return "" + return "" } return "Invalid(" + strconv.Itoa(int(t.Type)) + ")" } @@ -598,6 +598,11 @@ scriptDataDoubleEscapeEnd: // readComment reads the next comment token starting with "") return } @@ -628,19 +632,52 @@ func (z *Tokenizer) readComment() { if dashCount >= 2 { c = z.readByte() if z.err != nil { - z.data.end = z.raw.end + z.data.end = z.calculateAbruptCommentDataEnd() return - } - if c == '>' { + } else if c == '>' { z.data.end = z.raw.end - len("--!>") return + } else if c == '-' { + dashCount = 1 + beginning = false + continue } } } dashCount = 0 + beginning = false } } +func (z *Tokenizer) calculateAbruptCommentDataEnd() int { + raw := z.Raw() + const prefixLen = len("