summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-10 15:28:02 +0300
committerWolfy-J <[email protected]>2018-06-10 15:28:02 +0300
commita62237fa5afc310453e709837e363f0bb4d7ecf3 (patch)
tree9e89d28e40ef5e39df7975a8d598619d732896ce
parentee2e495a76c1cb0666f6f210ed0e59f94314b9e5 (diff)
fs config
-rw-r--r--http/fs_config_test.go15
-rw-r--r--http/parse.go2
-rw-r--r--http/server.go1
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