mirror of
https://github.com/tickstep/aliyunpan.git
synced 2025-01-23 14:32:14 +08:00
fix path format error
This commit is contained in:
parent
ac5eb94305
commit
d90894898f
@ -13,7 +13,7 @@ func FormatFilePath(filePath string) string {
|
||||
}
|
||||
|
||||
// 是否是windows路径
|
||||
matched, _ := regexp.MatchString("^[a-zA-Z]:*", filePath)
|
||||
matched, _ := regexp.MatchString("^([a-zA-Z]:)", filePath)
|
||||
if matched {
|
||||
// 去掉卷标签,例如:D:
|
||||
filePath = string([]rune(filePath)[2:])
|
||||
|
@ -6,5 +6,9 @@ import (
|
||||
)
|
||||
|
||||
func TestFormatFilePath(t *testing.T) {
|
||||
fmt.Println(FormatFilePath("D:/-beyond/p/9168473.html"))
|
||||
fmt.Println(FormatFilePath("D:\\-beyond\\p\\9168473.html"))
|
||||
}
|
||||
|
||||
func TestFormatFilePath2(t *testing.T) {
|
||||
fmt.Println(FormatFilePath("/my/folder/test.txt"))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user