mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-20 00:07:58 +08:00
jwt check the base file id
fix https://github.com/chrislusf/seaweedfs/issues/867
This commit is contained in:
31
weed/server/common_test.go
Normal file
31
weed/server/common_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package weed_server
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestParseURL(t *testing.T) {
|
||||
if vid, fid, _, _, _ := parseURLPath("/1,06dfa8a684"); true {
|
||||
if vid != "1" {
|
||||
t.Errorf("fail to parse vid: %s", vid)
|
||||
}
|
||||
if fid != "06dfa8a684" {
|
||||
t.Errorf("fail to parse fid: %s", fid)
|
||||
}
|
||||
}
|
||||
if vid, fid, _, _, _ := parseURLPath("/1,06dfa8a684_1"); true {
|
||||
if vid != "1" {
|
||||
t.Errorf("fail to parse vid: %s", vid)
|
||||
}
|
||||
if fid != "06dfa8a684_1" {
|
||||
t.Errorf("fail to parse fid: %s", fid)
|
||||
}
|
||||
if sepIndex := strings.LastIndex(fid, "_"); sepIndex > 0 {
|
||||
fid = fid[:sepIndex]
|
||||
}
|
||||
if fid != "06dfa8a684" {
|
||||
t.Errorf("fail to parse fid: %s", fid)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user