master
Evan Chen 2021-12-17 00:28:41 +08:00
parent 0a47f12905
commit 8621dc370e
1 changed files with 10 additions and 6 deletions

View File

@ -67,17 +67,21 @@ func Setup() {
segs := strings.Split(c, ":")
file := segs[len(segs)-2]
short := file
skip := false
ptr := 0
for i := len(file) - 1; i > 0; i-- {
if file[i] == '/' {
if !skip {
skip = true
continue
}
if ptr == 0 {
short = file[i+1:]
ptr = i
} else {
short = fmt.Sprintf("%v/%v", file[i+1:ptr], short)
break
}
}
if file[i] == '@' {
ptr = i
}
}
return fmt.Sprintf("%v:%v", short, segs[len(segs)-1])
}
return c