refactor: Redirect to / in case of unmatched path.
This commit is contained in:
parent
3941d4761d
commit
a4cc579fe3
2
main.go
2
main.go
@ -267,7 +267,7 @@ func handleDirectDownload(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
func handleRoot(w http.ResponseWriter, r *http.Request) {
|
func handleRoot(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.URL.Path != "/" && r.URL.Path != "" {
|
if r.URL.Path != "/" && r.URL.Path != "" {
|
||||||
w.WriteHeader(http.StatusNotFound)
|
http.Redirect(w, r, "/", http.StatusPermanentRedirect)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user