mirror of
https://github.com/AlistGo/alist.git
synced 2025-04-20 03:08:46 +08:00

* refactor:Prepare to remove the get interface * feat:add obj Unwarp interface * refactor:obj name mapping and program internal path processing * chore: fix typo * feat: unwrap get * fix: no use op.Get to get parent id * fix: set the path uniformly Co-authored-by: Noah Hsu <i@nn.ci>
23 lines
516 B
Go
23 lines
516 B
Go
package utils
|
|
|
|
import "testing"
|
|
|
|
func TestEncodePath(t *testing.T) {
|
|
t.Log(EncodePath("http://localhost:5244/d/123#.png"))
|
|
}
|
|
|
|
func TestFixAndCleanPath(t *testing.T) {
|
|
datas := map[string]string{
|
|
"": "/",
|
|
".././": "/",
|
|
"../../.../": "/...",
|
|
"x//\\y/": "/x/y",
|
|
".././.x/.y/.//..x../..y..": "/.x/.y/..x../..y..",
|
|
}
|
|
for key, value := range datas {
|
|
if FixAndCleanPath(key) != value {
|
|
t.Logf("raw %s fix fail", key)
|
|
}
|
|
}
|
|
}
|