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