mirror of
https://github.com/kataras/iris.git
synced 2026-01-10 21:45:57 +00:00
:)
This commit is contained in:
@@ -135,7 +135,7 @@ func expectTokenSlash(s string) (token, rest string) {
|
||||
|
||||
func expectQuality(s string) (q float64, rest string) {
|
||||
switch {
|
||||
case len(s) == 0:
|
||||
case s == "":
|
||||
return -1, ""
|
||||
case s[0] == '0':
|
||||
q = 0
|
||||
|
||||
@@ -102,7 +102,7 @@ func NewCompressWriter(w io.Writer, encoding string, level int) (cw CompressWrit
|
||||
}
|
||||
cw = brotli.NewWriterLevel(w, level)
|
||||
case SNAPPY:
|
||||
cw = snappy.NewWriter(w)
|
||||
cw = snappy.NewBufferedWriter(w)
|
||||
case S2:
|
||||
cw = s2.NewWriter(w)
|
||||
default:
|
||||
|
||||
@@ -1979,8 +1979,8 @@ func (ctx *Context) UploadFormFiles(destDirectory string, before ...func(*Contex
|
||||
// which could lead to override existing system files
|
||||
// by ../../$file.
|
||||
// Reported by Frank through security reports.
|
||||
file.Filename = strings.TrimLeft(file.Filename, "../")
|
||||
file.Filename = strings.TrimLeft(file.Filename, "..\\")
|
||||
file.Filename = strings.ReplaceAll(file.Filename, "../", "")
|
||||
file.Filename = strings.ReplaceAll(file.Filename, "..\\", "")
|
||||
|
||||
for _, b := range before {
|
||||
if !b(ctx, file) {
|
||||
@@ -2859,10 +2859,8 @@ func (ctx *Context) CompressReader(enable bool) error {
|
||||
return err
|
||||
}
|
||||
ctx.request.Body = r
|
||||
} else {
|
||||
if ok {
|
||||
ctx.request.Body = cr.Src
|
||||
}
|
||||
} else if ok {
|
||||
ctx.request.Body = cr.Src
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -3208,9 +3206,9 @@ func WriteJSON(writer io.Writer, v interface{}, options JSON, optimize bool) (in
|
||||
}
|
||||
|
||||
if options.UnescapeHTML {
|
||||
result = bytes.Replace(result, ltHex, lt, -1)
|
||||
result = bytes.Replace(result, gtHex, gt, -1)
|
||||
result = bytes.Replace(result, andHex, and, -1)
|
||||
result = bytes.ReplaceAll(result, ltHex, lt)
|
||||
result = bytes.ReplaceAll(result, gtHex, gt)
|
||||
result = bytes.ReplaceAll(result, andHex, and)
|
||||
}
|
||||
|
||||
if prependSecure {
|
||||
|
||||
Reference in New Issue
Block a user