allow /web/ without extra redirect

This commit is contained in:
Umputun
2018-02-12 14:52:18 -06:00
parent c2e44e2870
commit 7419686aaf
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -405,8 +405,8 @@ func (s *Server) voteCtrl(w http.ResponseWriter, r *http.Request) {
// serves static files from /web
func (s *Server) addFileServer(r chi.Router, path string, root http.FileSystem) {
log.Printf("[INFO] run file server for %s", root)
fs := http.StripPrefix(path, http.FileServer(root))
if path != "/" && path[len(path)-1] != '/' {
r.Get(path, http.RedirectHandler(path+"/", 301).ServeHTTP)
path += "/"
@@ -415,7 +415,7 @@ func (s *Server) addFileServer(r chi.Router, path string, root http.FileSystem)
r.Get(path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// don't show dirs, just serve files
if strings.HasSuffix(r.URL.Path, "/") {
if strings.HasSuffix(r.URL.Path, "/") && len(r.URL.Path) > 1 && r.URL.Path != "/web/" {
http.NotFound(w, r)
return
}
+2 -2
View File
@@ -17,7 +17,7 @@
<h3>Information Collection and Use</h3>
<p>
For a better experience while using our Service, we may require you to provide us with certain personally identifiable information,
including but not limited to your name and email addres. The information that we collect will be used to contact
including but not limited to your name and email address. The information that we collect will be used to contact
or identify you.
</p>
@@ -31,7 +31,7 @@
<h3>Cookies</h3>
<p>Cookies are files with small amount of data that is commonly used an anonymous unique identifier. These are sent to your
browser from the website that you visit and are stored on your computers hard drive. Our website uses these “cookies”
to comnfirm user identity. You have the option to either accept or refuse these cookies, and know when a cookie is
to confirm user identity. You have the option to either accept or refuse these cookies, and know when a cookie is
being sent to your computer. If you choose to refuse our cookies, you may not be able to use some portions of our
Service.
</p>