clean up
This commit is contained in:
parent
96b92fed5e
commit
a17deb4af1
6 changed files with 27 additions and 87 deletions
|
@ -298,7 +298,6 @@ func handleImageServe(w http.ResponseWriter, r *http.Request) {
|
|||
if _, err := io.Copy(w, resp.Body); err != nil {
|
||||
printWarn("Error writing image to response: %v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func handleImageStatus(w http.ResponseWriter, r *http.Request) {
|
||||
|
@ -505,19 +504,12 @@ func cleanupCache() {
|
|||
}
|
||||
}
|
||||
|
||||
func getContentType(ext string) string {
|
||||
switch strings.ToLower(ext) {
|
||||
case "svg":
|
||||
return "image/svg+xml"
|
||||
case "jpg", "jpeg":
|
||||
return "image/jpeg"
|
||||
case "png":
|
||||
return "image/png"
|
||||
case "gif":
|
||||
return "image/gif"
|
||||
case "webp":
|
||||
return "image/webp"
|
||||
default:
|
||||
return "application/octet-stream"
|
||||
}
|
||||
// Serve missing.svg
|
||||
func serveMissingImage(w http.ResponseWriter, r *http.Request) {
|
||||
missingImagePath := filepath.Join("static", "images", "missing.svg")
|
||||
w.Header().Set("Content-Type", "image/svg+xml")
|
||||
w.Header().Set("Cache-Control", "no-store, must-revalidate")
|
||||
w.Header().Set("Pragma", "no-cache")
|
||||
w.Header().Set("Expires", "0")
|
||||
http.ServeFile(w, r, missingImagePath)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue