1
0

Moved robots.txt handling to Index().

This commit is contained in:
Alexander Andreev 2022-12-17 21:46:54 +04:00
parent b793da40d4
commit 007ab59c81
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F

View File

@ -37,11 +37,6 @@ func (FilesHandlers) AssetsFS() http.FileSystem {
return web.Assets()
}
func (FilesHandlers) Robots(w http.ResponseWriter, r *http.Request) {
fc, _ := web.AssetsGetFile("robots.txt")
w.Write(fc)
}
func (h *FilesHandlers) Index(w http.ResponseWriter, r *http.Request) {
path := httprouter.CleanPath(server.GetURLParam(r, "filepath"))
@ -50,6 +45,12 @@ func (h *FilesHandlers) Index(w http.ResponseWriter, r *http.Request) {
return
}
if strings.HasPrefix(path, "/robots.txt") {
fc, _ := web.AssetsGetFile("robots.txt")
w.Write(fc)
return
}
if strings.HasPrefix(path, "/file") {
if h.noFileHandling {
w.WriteHeader(http.StatusServiceUnavailable)