summaryrefslogtreecommitdiffstats
path: root/routers/repo/editor_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/editor_test.go')
-rw-r--r--routers/repo/editor_test.go26
1 files changed, 17 insertions, 9 deletions
diff --git a/routers/repo/editor_test.go b/routers/repo/editor_test.go
index e5b9570205..b3d4314c26 100644
--- a/routers/repo/editor_test.go
+++ b/routers/repo/editor_test.go
@@ -15,16 +15,24 @@ func TestCleanUploadName(t *testing.T) {
models.PrepareTestEnv(t)
var kases = map[string]string{
- ".git/refs/master": "git/refs/master",
- "/root/abc": "root/abc",
- "./../../abc": "abc",
- "a/../.git": "a/.git",
- "a/../../../abc": "a/abc",
- "../../../acd": "acd",
- "../../.git/abc": "git/abc",
- "..\\..\\.git/abc": "git/abc",
+ ".git/refs/master": "",
+ "/root/abc": "root/abc",
+ "./../../abc": "abc",
+ "a/../.git": "",
+ "a/../../../abc": "abc",
+ "../../../acd": "acd",
+ "../../.git/abc": "",
+ "..\\..\\.git/abc": "..\\..\\.git/abc",
+ "..\\../.git/abc": "",
+ "..\\../.git": "",
+ "abc/../def": "def",
+ ".drone.yml": ".drone.yml",
+ ".abc/def/.drone.yml": ".abc/def/.drone.yml",
+ "..drone.yml.": "..drone.yml.",
+ "..a.dotty...name...": "..a.dotty...name...",
+ "..a.dotty../.folder../.name...": "..a.dotty../.folder../.name...",
}
for k, v := range kases {
- assert.EqualValues(t, v, cleanUploadFileName(k))
+ assert.EqualValues(t, cleanUploadFileName(k), v)
}
}