aboutsummaryrefslogtreecommitdiff
path: root/dynamic.go
diff options
context:
space:
mode:
authorPacien2013-07-11 12:25:32 +0200
committerPacien2013-07-11 12:25:32 +0200
commit6c6767e9622aca9a965ac51156b09f4130819d61 (patch)
treeb8e3122e5b7161acff63d257f448102b532cc740 /dynamic.go
parentb439e1dae99a6253065b75abfb73d7aca8d8eeb5 (diff)
downloadfoldaweb-6c6767e9622aca9a965ac51156b09f4130819d61.tar.gz
Handle non-existent pages
Diffstat (limited to 'dynamic.go')
-rw-r--r--dynamic.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/dynamic.go b/dynamic.go
index ace70ed..9df04b9 100644
--- a/dynamic.go
+++ b/dynamic.go
@@ -46,7 +46,12 @@ func handle(w http.ResponseWriter, r *http.Request) {
46 // parse these dirs 46 // parse these dirs
47 elements := make(map[string][]byte) 47 elements := make(map[string][]byte)
48 for i := len(dirs) - 1; i >= 0; i-- { 48 for i := len(dirs) - 1; i >= 0; i-- {
49 elements = parse(path.Join(*settings.sourceDir, dirs[i]), elements, settings.exts, false) 49 parsed := false
50 elements, parsed = parse(path.Join(*settings.sourceDir, dirs[i]), elements, settings.exts, false)
51 if (i == len(dirs)-1) && !parsed {
52 http.Error(w, "404 page not found", http.StatusNotFound)
53 return
54 }
50 } 55 }
51 56
52 // render the page 57 // render the page