MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / buildEtag

Function buildEtag

storage/fs/reader.go:114–118  ·  view source on GitHub ↗
(path string, fi fs.FileInfo)

Source from the content-addressed store, hash-verified

112}
113
114func buildEtag(path string, fi fs.FileInfo) string {
115 tag := fmt.Sprintf("%s__%d__%d", path, fi.Size(), fi.ModTime().UnixNano())
116 hash := sha256.Sum256([]byte(tag))
117 return `"` + base64.RawURLEncoding.EncodeToString(hash[:]) + `"`
118}
119
120// detectContentType detects the content type of a file by mime or extension
121func detectContentType(f http.File, fi fs.FileInfo) string {

Callers 1

GetObjectMethod · 0.85

Calls 1

SizeMethod · 0.65

Tested by

no test coverage detected