File tree 1 file changed +4
-4
lines changed
cmd/git-bundle-web-server
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ func serve(w http.ResponseWriter, r *http.Request) {
42
42
43
43
owner , repo , file , err := parseRoute (path )
44
44
if err != nil {
45
- // TODO: report a failure to the user somehow. 404?
45
+ w . WriteHeader ( http . StatusNotFound )
46
46
fmt .Printf ("Failed to parse route: %s\n " , err )
47
47
return
48
48
}
@@ -51,14 +51,14 @@ func serve(w http.ResponseWriter, r *http.Request) {
51
51
52
52
repos , err := core .GetRepositories ()
53
53
if err != nil {
54
- // TODO: report a 500
54
+ w . WriteHeader ( http . StatusInternalServerError )
55
55
fmt .Printf ("Failed to load routes\n " )
56
56
return
57
57
}
58
58
59
59
repository , contains := repos [route ]
60
60
if ! contains {
61
- // TODO: report a 404
61
+ w . WriteHeader ( http . StatusNotFound )
62
62
fmt .Printf ("Failed to get route out of repos\n " )
63
63
return
64
64
}
@@ -70,7 +70,7 @@ func serve(w http.ResponseWriter, r *http.Request) {
70
70
fileToServe := repository .WebDir + "/" + file
71
71
data , err := os .ReadFile (fileToServe )
72
72
if err != nil {
73
- // TODO: return a 404
73
+ w . WriteHeader ( http . StatusNotFound )
74
74
fmt .Printf ("Failed to read file\n " )
75
75
return
76
76
}
You can’t perform that action at this time.
0 commit comments