Logic helping functions
(content_type string, hr HandlerReq)
| 272 | // Logic helping functions |
| 273 | |
| 274 | func sendFile(content_type string, hr HandlerReq) { |
| 275 | w, r := hr.w, hr.r |
| 276 | req_file := path.Join(hr.Dir, hr.File) |
| 277 | |
| 278 | f, err := os.Stat(req_file) |
| 279 | if os.IsNotExist(err) { |
| 280 | renderNotFound(w) |
| 281 | return |
| 282 | } |
| 283 | |
| 284 | w.Header().Set("Content-Type", content_type) |
| 285 | w.Header().Set("Content-Length", fmt.Sprintf("%d", f.Size())) |
| 286 | w.Header().Set("Last-Modified", f.ModTime().Format(http.TimeFormat)) |
| 287 | http.ServeFile(w, r, req_file) |
| 288 | } |
| 289 | |
| 290 | func getGitDir(file_path string) (string, error) { |
| 291 | root := DefaultConfig.ProjectRoot |
no test coverage detected
searching dependent graphs…