MCPcopy
hub / github.com/mattermost/mattermost / contentTypeMatches

Function contentTypeMatches

server/platform/services/imageproxy/local.go:298–310  ·  view source on GitHub ↗

contentTypeMatches returns whether contentType matches one of the allowed patterns.

(patterns []string, contentType string)

Source from the content-addressed store, hash-verified

296
297// contentTypeMatches returns whether contentType matches one of the allowed patterns.
298func 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.

Callers 1

ServeImageMethod · 0.85

Calls 1

MatchMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…