Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alist-org
GitHub Repository: alist-org/alist
Path: blob/main/pkg/utils/path_test.go
1560 views
1
package utils
2
3
import "testing"
4
5
func TestEncodePath(t *testing.T) {
6
t.Log(EncodePath("http://localhost:5244/d/123#.png"))
7
}
8
9
func TestFixAndCleanPath(t *testing.T) {
10
datas := map[string]string{
11
"": "/",
12
".././": "/",
13
"../../.../": "/...",
14
"x//\\y/": "/x/y",
15
".././.x/.y/.//..x../..y..": "/.x/.y/..x../..y..",
16
}
17
for key, value := range datas {
18
if FixAndCleanPath(key) != value {
19
t.Logf("raw %s fix fail", key)
20
}
21
}
22
}
23
24