contentTypeMatches returns whether contentType matches one of the allowed patterns.
(patterns []string, contentType string)
| 296 | |
| 297 | // contentTypeMatches returns whether contentType matches one of the allowed patterns. |
| 298 | func contentTypeMatches(patterns []string, contentType string) bool { |
| 299 | if len(patterns) == 0 { |
| 300 | return true |
| 301 | } |
| 302 | |
| 303 | for _, pattern := range patterns { |
| 304 | if ok, err := path.Match(pattern, contentType); ok && err == nil { |
| 305 | return true |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | return false |
| 310 | } |
| 311 | |
| 312 | // proxyRequest is an imageproxy request which includes a remote URL of an image to |
| 313 | // proxy. |
no test coverage detected
searching dependent graphs…