(w http.ResponseWriter, r *http.Request)
| 519 | } |
| 520 | |
| 521 | func DataImages(w http.ResponseWriter, r *http.Request) { |
| 522 | |
| 523 | var path = strings.TrimPrefix(r.URL.Path, "/") |
| 524 | systemMutex.Lock() |
| 525 | filePath := System.Folder.ImagesUpload + getFilenameFromPath(path) |
| 526 | systemMutex.Unlock() |
| 527 | |
| 528 | content, err := readByteFromFile(filePath) |
| 529 | if err != nil { |
| 530 | httpStatusError(w, r, 404) |
| 531 | return |
| 532 | } |
| 533 | |
| 534 | w.Header().Add("Content-Type", getContentType(filePath)) |
| 535 | w.Header().Add("Content-Length", fmt.Sprintf("%d", len(content))) |
| 536 | w.WriteHeader(200) |
| 537 | w.Write(content) |
| 538 | |
| 539 | return |
| 540 | } |
| 541 | |
| 542 | func WS(w http.ResponseWriter, r *http.Request) { |
| 543 |
nothing calls this directly
no test coverage detected