diff options
-rw-r--r-- | http/fs_config_test.go | 15 | ||||
-rw-r--r-- | http/parse.go | 2 | ||||
-rw-r--r-- | http/server.go | 1 |
3 files changed, 16 insertions, 2 deletions
diff --git a/http/fs_config_test.go b/http/fs_config_test.go new file mode 100644 index 00000000..05f568e5 --- /dev/null +++ b/http/fs_config_test.go @@ -0,0 +1,15 @@ +package http + +import ( + "testing" + "github.com/stretchr/testify/assert" +) + +func TestFsConfig_Forbids(t *testing.T) { + cfg := FsConfig{Forbid: []string{".php"}} + + assert.True(t, cfg.Forbids("index.php")) + assert.True(t, cfg.Forbids("index.PHP")) + assert.True(t, cfg.Forbids("phpadmin/index.bak.php")) + assert.False(t, cfg.Forbids("index.html")) +} diff --git a/http/parse.go b/http/parse.go index fe8361d6..898f39a1 100644 --- a/http/parse.go +++ b/http/parse.go @@ -69,7 +69,7 @@ func (d dataTree) mount(i []string, v []string) { } // parse incoming dataTree request into JSON (including multipart form dataTree) -func parseUploads(r *http.Request, cfg *UploadsConfig) (*Uploads, error) { +func parseUploads(r *http.Request, cfg *FsConfig) (*Uploads, error) { u := &Uploads{ cfg: cfg, tree: make(fileTree), diff --git a/http/server.go b/http/server.go deleted file mode 100644 index d02cfda6..00000000 --- a/http/server.go +++ /dev/null @@ -1 +0,0 @@ -package http |