Skip to content

Commit bc3f2d0

Browse files
committed
fix error
1 parent ef3dab1 commit bc3f2d0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ func main() {
2222
fmt.Println("from", from)
2323

2424
from = strings.ReplaceAll(from, "\\", "/")
25-
fromParts := strings.Split(from, "/")
26-
wxid := fromParts[len(fromParts)-3]
25+
fromPaths := strings.Split(from, "/")
2726

27+
var wxid string
28+
wxidIndex := len(fromPaths) - 3
29+
if wxidIndex >= 0 {
30+
wxid = fromPaths[wxidIndex]
31+
}
2832
needDecrypt := strings.HasPrefix(wxid, "wx")
2933
if needDecrypt {
3034
fmt.Println("wxid", wxid)

0 commit comments

Comments
 (0)