(w http.ResponseWriter, r *http.Request)
| 498 | } |
| 499 | |
| 500 | func Images(w http.ResponseWriter, r *http.Request) { |
| 501 | |
| 502 | var path = strings.TrimPrefix(r.URL.Path, "/") |
| 503 | systemMutex.Lock() |
| 504 | filePath := System.Folder.ImagesCache + getFilenameFromPath(path) |
| 505 | systemMutex.Unlock() |
| 506 | |
| 507 | content, err := readByteFromFile(filePath) |
| 508 | if err != nil { |
| 509 | httpStatusError(w, r, 404) |
| 510 | return |
| 511 | } |
| 512 | |
| 513 | w.Header().Add("Content-Type", getContentType(filePath)) |
| 514 | w.Header().Add("Content-Length", fmt.Sprintf("%d", len(content))) |
| 515 | w.WriteHeader(200) |
| 516 | w.Write(content) |
| 517 | |
| 518 | return |
| 519 | } |
| 520 | |
| 521 | func DataImages(w http.ResponseWriter, r *http.Request) { |
| 522 |
nothing calls this directly
no test coverage detected