mirror of
https://github.com/containers/podman.git
synced 2025-12-01 18:49:18 +08:00
chore(deps): update module github.com/gin-gonic/gin to v1.9.1 [security]
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
committed by
Valentin Rothberg
parent
b994f8610d
commit
6fd4ae6d29
29
vendor/github.com/gin-gonic/gin/context.go
generated
vendored
29
vendor/github.com/gin-gonic/gin/context.go
generated
vendored
@@ -652,7 +652,7 @@ func (c *Context) BindYAML(obj any) error {
|
||||
}
|
||||
|
||||
// BindTOML is a shortcut for c.MustBindWith(obj, binding.TOML).
|
||||
func (c *Context) BindTOML(obj interface{}) error {
|
||||
func (c *Context) BindTOML(obj any) error {
|
||||
return c.MustBindWith(obj, binding.TOML)
|
||||
}
|
||||
|
||||
@@ -717,7 +717,7 @@ func (c *Context) ShouldBindYAML(obj any) error {
|
||||
}
|
||||
|
||||
// ShouldBindTOML is a shortcut for c.ShouldBindWith(obj, binding.TOML).
|
||||
func (c *Context) ShouldBindTOML(obj interface{}) error {
|
||||
func (c *Context) ShouldBindTOML(obj any) error {
|
||||
return c.ShouldBindWith(obj, binding.TOML)
|
||||
}
|
||||
|
||||
@@ -995,7 +995,7 @@ func (c *Context) YAML(code int, obj any) {
|
||||
}
|
||||
|
||||
// TOML serializes the given struct as TOML into the response body.
|
||||
func (c *Context) TOML(code int, obj interface{}) {
|
||||
func (c *Context) TOML(code int, obj any) {
|
||||
c.Render(code, render.TOML{Data: obj})
|
||||
}
|
||||
|
||||
@@ -1052,11 +1052,17 @@ func (c *Context) FileFromFS(filepath string, fs http.FileSystem) {
|
||||
http.FileServer(fs).ServeHTTP(c.Writer, c.Request)
|
||||
}
|
||||
|
||||
var quoteEscaper = strings.NewReplacer("\\", "\\\\", `"`, "\\\"")
|
||||
|
||||
func escapeQuotes(s string) string {
|
||||
return quoteEscaper.Replace(s)
|
||||
}
|
||||
|
||||
// FileAttachment writes the specified file into the body stream in an efficient way
|
||||
// On the client side, the file will typically be downloaded with the given filename
|
||||
func (c *Context) FileAttachment(filepath, filename string) {
|
||||
if isASCII(filename) {
|
||||
c.Writer.Header().Set("Content-Disposition", `attachment; filename="`+filename+`"`)
|
||||
c.Writer.Header().Set("Content-Disposition", `attachment; filename="`+escapeQuotes(filename)+`"`)
|
||||
} else {
|
||||
c.Writer.Header().Set("Content-Disposition", `attachment; filename*=UTF-8''`+url.QueryEscape(filename))
|
||||
}
|
||||
@@ -1174,9 +1180,16 @@ func (c *Context) SetAccepted(formats ...string) {
|
||||
/***** GOLANG.ORG/X/NET/CONTEXT *****/
|
||||
/************************************/
|
||||
|
||||
// hasRequestContext returns whether c.Request has Context and fallback.
|
||||
func (c *Context) hasRequestContext() bool {
|
||||
hasFallback := c.engine != nil && c.engine.ContextWithFallback
|
||||
hasRequestContext := c.Request != nil && c.Request.Context() != nil
|
||||
return hasFallback && hasRequestContext
|
||||
}
|
||||
|
||||
// Deadline returns that there is no deadline (ok==false) when c.Request has no Context.
|
||||
func (c *Context) Deadline() (deadline time.Time, ok bool) {
|
||||
if !c.engine.ContextWithFallback || c.Request == nil || c.Request.Context() == nil {
|
||||
if !c.hasRequestContext() {
|
||||
return
|
||||
}
|
||||
return c.Request.Context().Deadline()
|
||||
@@ -1184,7 +1197,7 @@ func (c *Context) Deadline() (deadline time.Time, ok bool) {
|
||||
|
||||
// Done returns nil (chan which will wait forever) when c.Request has no Context.
|
||||
func (c *Context) Done() <-chan struct{} {
|
||||
if !c.engine.ContextWithFallback || c.Request == nil || c.Request.Context() == nil {
|
||||
if !c.hasRequestContext() {
|
||||
return nil
|
||||
}
|
||||
return c.Request.Context().Done()
|
||||
@@ -1192,7 +1205,7 @@ func (c *Context) Done() <-chan struct{} {
|
||||
|
||||
// Err returns nil when c.Request has no Context.
|
||||
func (c *Context) Err() error {
|
||||
if !c.engine.ContextWithFallback || c.Request == nil || c.Request.Context() == nil {
|
||||
if !c.hasRequestContext() {
|
||||
return nil
|
||||
}
|
||||
return c.Request.Context().Err()
|
||||
@@ -1213,7 +1226,7 @@ func (c *Context) Value(key any) any {
|
||||
return val
|
||||
}
|
||||
}
|
||||
if !c.engine.ContextWithFallback || c.Request == nil || c.Request.Context() == nil {
|
||||
if !c.hasRequestContext() {
|
||||
return nil
|
||||
}
|
||||
return c.Request.Context().Value(key)
|
||||
|
||||
Reference in New Issue
Block a user