(path string, fi fs.FileInfo)
| 112 | } |
| 113 | |
| 114 | func 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 |
| 121 | func detectContentType(f http.File, fi fs.FileInfo) string { |