diff --git a/go.mod b/go.mod index 408de6480..3a98d8afc 100644 --- a/go.mod +++ b/go.mod @@ -87,7 +87,7 @@ require ( github.com/stretchr/testify v1.9.0 github.com/test-go/testify v1.1.4 github.com/thejerf/suture/v4 v4.0.5 - github.com/tidwall/gjson v1.17.1 + github.com/tidwall/gjson v1.17.3 github.com/tus/tusd/v2 v2.4.0 github.com/unrolled/secure v1.14.0 github.com/urfave/cli/v2 v2.27.3 diff --git a/go.sum b/go.sum index 068929487..a166f3b14 100644 --- a/go.sum +++ b/go.sum @@ -1158,8 +1158,8 @@ github.com/thanhpk/randstr v1.0.6 h1:psAOktJFD4vV9NEVb3qkhRSMvYh4ORRaj1+w/hn4B+o github.com/thanhpk/randstr v1.0.6/go.mod h1:M/H2P1eNLZzlDwAzpkkkUvoyNNMbzRGhESZuEQk3r0U= github.com/thejerf/suture/v4 v4.0.5 h1:F1E/4FZwXWqvlWDKEUo6/ndLtxGAUzMmNqkrMknZbAA= github.com/thejerf/suture/v4 v4.0.5/go.mod h1:gu9Y4dXNUWFrByqRt30Rm9/UZ0wzRSt9AJS6xu/ZGxU= -github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U= -github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.17.3 h1:bwWLZU7icoKRG+C+0PNwIKC6FCJO/Q3p2pZvuP0jN94= +github.com/tidwall/gjson v1.17.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= diff --git a/vendor/github.com/tidwall/gjson/README.md b/vendor/github.com/tidwall/gjson/README.md index 96b2e4dc3..7701cae43 100644 --- a/vendor/github.com/tidwall/gjson/README.md +++ b/vendor/github.com/tidwall/gjson/README.md @@ -1,7 +1,9 @@
-
+
+
diff --git a/vendor/github.com/tidwall/gjson/SYNTAX.md b/vendor/github.com/tidwall/gjson/SYNTAX.md
index 6721d7f51..a3f0fac23 100644
--- a/vendor/github.com/tidwall/gjson/SYNTAX.md
+++ b/vendor/github.com/tidwall/gjson/SYNTAX.md
@@ -1,6 +1,6 @@
# GJSON Path Syntax
-A GJSON Path is a text string syntax that describes a search pattern for quickly retreiving values from a JSON payload.
+A GJSON Path is a text string syntax that describes a search pattern for quickly retrieving values from a JSON payload.
This document is designed to explain the structure of a GJSON Path through examples.
@@ -15,12 +15,12 @@ This document is designed to explain the structure of a GJSON Path through examp
- [Multipaths](#multipaths)
- [Literals](#literals)
-The definitive implemenation is [github.com/tidwall/gjson](https://github.com/tidwall/gjson).
+The definitive implementation is [github.com/tidwall/gjson](https://github.com/tidwall/gjson).
Use the [GJSON Playground](https://gjson.dev) to experiment with the syntax online.
## Path structure
-A GJSON Path is intended to be easily expressed as a series of components seperated by a `.` character.
+A GJSON Path is intended to be easily expressed as a series of components separated by a `.` character.
Along with `.` character, there are a few more that have special meaning, including `|`, `#`, `@`, `\`, `*`, `!`, and `?`.
@@ -46,7 +46,7 @@ The following GJSON Paths evaluate to the accompanying values.
### Basic
-In many cases you'll just want to retreive values by object name or array index.
+In many cases you'll just want to retrieve values by object name or array index.
```go
name.last "Anderson"
diff --git a/vendor/github.com/tidwall/gjson/gjson.go b/vendor/github.com/tidwall/gjson/gjson.go
index 4acd087c0..779fe617f 100644
--- a/vendor/github.com/tidwall/gjson/gjson.go
+++ b/vendor/github.com/tidwall/gjson/gjson.go
@@ -1252,7 +1252,7 @@ func parseObject(c *parseContext, i int, path string) (int, bool) {
}
// matchLimit will limit the complexity of the match operation to avoid ReDos
-// attacks from arbritary inputs.
+// attacks from arbitrary inputs.
// See the github.com/tidwall/match.MatchLimit function for more information.
func matchLimit(str, pattern string) bool {
matched, _ := match.MatchLimit(str, pattern, 10000)
@@ -1917,6 +1917,16 @@ func appendHex16(dst []byte, x uint16) []byte {
)
}
+// DisableEscapeHTML will disable the automatic escaping of certain
+// "problamatic" HTML characters when encoding to JSON.
+// These character include '>', '<' and '&', which get escaped to \u003e,
+// \u0026, and \u003c respectively.
+//
+// This is a global flag and will affect all further gjson operations.
+// Ideally, if used, it should be set one time before other gjson functions
+// are called.
+var DisableEscapeHTML = false
+
// AppendJSONString is a convenience function that converts the provided string
// to a valid JSON string and appends it to dst.
func AppendJSONString(dst []byte, s string) []byte {
@@ -1940,7 +1950,8 @@ func AppendJSONString(dst []byte, s string) []byte {
dst = append(dst, 'u')
dst = appendHex16(dst, uint16(s[i]))
}
- } else if s[i] == '>' || s[i] == '<' || s[i] == '&' {
+ } else if !DisableEscapeHTML &&
+ (s[i] == '>' || s[i] == '<' || s[i] == '&') {
dst = append(dst, '\\', 'u')
dst = appendHex16(dst, uint16(s[i]))
} else if s[i] == '\\' {
@@ -2194,7 +2205,7 @@ func unescape(json string) string {
}
// Less return true if a token is less than another token.
-// The caseSensitive paramater is used when the tokens are Strings.
+// The caseSensitive parameter is used when the tokens are Strings.
// The order when comparing two different type is:
//
// Null < False < Number < String < True < JSON
@@ -3353,7 +3364,7 @@ func (t Result) Path(json string) string {
goto fail
}
if !strings.HasPrefix(json[t.Index:], t.Raw) {
- // Result is not at the JSON index as exepcted.
+ // Result is not at the JSON index as expected.
goto fail
}
for ; i >= 0; i-- {
diff --git a/vendor/github.com/tidwall/gjson/logo.png b/vendor/github.com/tidwall/gjson/logo.png
deleted file mode 100644
index 17a8bbe9d..000000000
Binary files a/vendor/github.com/tidwall/gjson/logo.png and /dev/null differ
diff --git a/vendor/github.com/tus/tusd/v2/pkg/handler/unrouted_handler.go b/vendor/github.com/tus/tusd/v2/pkg/handler/unrouted_handler.go
index b91161bb7..73be46437 100644
--- a/vendor/github.com/tus/tusd/v2/pkg/handler/unrouted_handler.go
+++ b/vendor/github.com/tus/tusd/v2/pkg/handler/unrouted_handler.go
@@ -691,14 +691,12 @@ func (handler *UnroutedHandler) HeadFile(w http.ResponseWriter, r *http.Request)
// PatchFile adds a chunk to an upload. This operation is only allowed
// if enough space in the upload is left.
func (handler *UnroutedHandler) PatchFile(w http.ResponseWriter, r *http.Request) {
- fmt.Println("PATCH FILE")
c := handler.getContext(w, r)
isTusV1 := !handler.usesIETFDraft(r)
// Check for presence of application/offset+octet-stream
if isTusV1 && r.Header.Get("Content-Type") != "application/offset+octet-stream" {
- fmt.Println("WRONG CONTENT TYPE")
handler.sendError(c, ErrInvalidContentType)
return
}
@@ -706,14 +704,12 @@ func (handler *UnroutedHandler) PatchFile(w http.ResponseWriter, r *http.Request
// Check for presence of a valid Upload-Offset Header
offset, err := strconv.ParseInt(r.Header.Get("Upload-Offset"), 10, 64)
if err != nil || offset < 0 {
- fmt.Println("WRONG OFFSET")
handler.sendError(c, ErrInvalidOffset)
return
}
id, err := extractIDFromPath(r.URL.Path)
if err != nil {
- fmt.Println("WRONG ID")
handler.sendError(c, err)
return
}
@@ -722,7 +718,6 @@ func (handler *UnroutedHandler) PatchFile(w http.ResponseWriter, r *http.Request
if handler.composer.UsesLocker {
lock, err := handler.lockUpload(c, id)
if err != nil {
- fmt.Println("WRONG LOCK")
handler.sendError(c, err)
return
}
@@ -732,27 +727,23 @@ func (handler *UnroutedHandler) PatchFile(w http.ResponseWriter, r *http.Request
upload, err := handler.composer.Core.GetUpload(c, id)
if err != nil {
- fmt.Println("WRONG UPLOAD")
handler.sendError(c, err)
return
}
info, err := upload.GetInfo(c)
if err != nil {
- fmt.Println("WRONG INFO")
handler.sendError(c, err)
return
}
// Modifying a final upload is not allowed
if info.IsFinal {
- fmt.Println("WRONG FINAL")
handler.sendError(c, ErrModifyFinal)
return
}
if offset != info.Offset {
- fmt.Println("WRONG INFO OFFSET")
handler.sendError(c, ErrMismatchOffset)
return
}
@@ -769,32 +760,27 @@ func (handler *UnroutedHandler) PatchFile(w http.ResponseWriter, r *http.Request
// Do not proxy the call to the data store if the upload is already completed
if !info.SizeIsDeferred && info.Offset == info.Size {
resp.Header["Upload-Offset"] = strconv.FormatInt(offset, 10)
- fmt.Println("UPLOAD ALREADY COMPLETED")
handler.sendResp(c, resp)
return
}
if r.Header.Get("Upload-Length") != "" {
if !handler.composer.UsesLengthDeferrer {
- fmt.Println("UPLOAD LENGTH DEFERRER")
handler.sendError(c, ErrNotImplemented)
return
}
if !info.SizeIsDeferred {
- fmt.Println("UPLOAD LENGTH NOT DEFERED")
handler.sendError(c, ErrInvalidUploadLength)
return
}
uploadLength, err := strconv.ParseInt(r.Header.Get("Upload-Length"), 10, 64)
if err != nil || uploadLength < 0 || uploadLength < info.Offset || (handler.config.MaxSize > 0 && uploadLength > handler.config.MaxSize) {
- fmt.Println("UPLOAD LENGTH INVALID")
handler.sendError(c, ErrInvalidUploadLength)
return
}
lengthDeclarableUpload := handler.composer.LengthDeferrer.AsLengthDeclarableUpload(upload)
if err := lengthDeclarableUpload.DeclareLength(c, uploadLength); err != nil {
- fmt.Println("UPLOAD LENGTH DECLARED")
handler.sendError(c, err)
return
}
@@ -805,7 +791,6 @@ func (handler *UnroutedHandler) PatchFile(w http.ResponseWriter, r *http.Request
resp, err = handler.writeChunk(c, resp, upload, info)
if err != nil {
- fmt.Println("CANT WRITE CHUNK")
handler.sendError(c, err)
return
}
@@ -814,7 +799,6 @@ func (handler *UnroutedHandler) PatchFile(w http.ResponseWriter, r *http.Request
if willCompleteUpload && info.SizeIsDeferred {
info, err = upload.GetInfo(c)
if err != nil {
- fmt.Println("CANT GET INFO")
handler.sendError(c, err)
return
}
@@ -823,7 +807,6 @@ func (handler *UnroutedHandler) PatchFile(w http.ResponseWriter, r *http.Request
lengthDeclarableUpload := handler.composer.LengthDeferrer.AsLengthDeclarableUpload(upload)
if err := lengthDeclarableUpload.DeclareLength(c, uploadLength); err != nil {
- fmt.Println("CANT UPLOAD LENGTH")
handler.sendError(c, err)
return
}
@@ -833,14 +816,12 @@ func (handler *UnroutedHandler) PatchFile(w http.ResponseWriter, r *http.Request
resp, err = handler.finishUploadIfComplete(c, resp, upload, info)
if err != nil {
- fmt.Println("CANT COMPLETE")
handler.sendError(c, err)
return
}
}
handler.sendResp(c, resp)
- fmt.Println("PATCH COMPLETE")
}
// writeChunk reads the body from the requests r and appends it to the upload
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 9324a6a56..9796b4f5e 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1861,7 +1861,7 @@ github.com/test-go/testify/require
# github.com/thejerf/suture/v4 v4.0.5
## explicit; go 1.9
github.com/thejerf/suture/v4
-# github.com/tidwall/gjson v1.17.1
+# github.com/tidwall/gjson v1.17.3
## explicit; go 1.12
github.com/tidwall/gjson
# github.com/tidwall/match v1.1.1