summaryrefslogtreecommitdiff
path: root/service/static/service.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-01-10 11:53:16 +0300
committerWolfy-J <[email protected]>2019-01-10 11:53:16 +0300
commit35bd2c861daf7a3895dc9d99642b53f2107bf5bf (patch)
treea47f3ef674824e0138783d443bb6c0afb483314e /service/static/service.go
parentd1532db3043a1038f287fe31d1f2537d37d4d3a9 (diff)
always serve files
Diffstat (limited to 'service/static/service.go')
-rw-r--r--service/static/service.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/service/static/service.go b/service/static/service.go
index 2cb419fe..b824e787 100644
--- a/service/static/service.go
+++ b/service/static/service.go
@@ -45,12 +45,17 @@ func (s *Service) middleware(f http.HandlerFunc) http.HandlerFunc {
func (s *Service) handleStatic(w http.ResponseWriter, r *http.Request) bool {
fPath := path.Clean(r.URL.Path)
- if s.cfg.Forbids(fPath) {
+ if s.cfg.AlwaysForbid(fPath) {
return false
}
f, err := s.root.Open(fPath)
if err != nil {
+ if s.cfg.AlwaysServe(fPath) {
+ w.WriteHeader(404)
+ return true
+ }
+
return false
}
defer f.Close()