Skip to content

Commit

Permalink
filepath.Clean
Browse files Browse the repository at this point in the history
  • Loading branch information
quzard committed Jan 16, 2025
1 parent acbab9b commit 49ebe6e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions plugins/input/docker/logmeta/metric_container_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"os"
"path"
"path/filepath"
"reflect"
"regexp"
"sort"
Expand Down Expand Up @@ -117,10 +118,7 @@ func formatPath(path string) string {
if len(path) == 0 {
return path
}
// 处理开头的多个/
if strings.HasPrefix(path, "/") {
path = "/" + strings.TrimLeft(path, "/")
}
path = filepath.Clean(path)
if path[len(path)-1] == '/' {
return path[0 : len(path)-1]
}
Expand Down

0 comments on commit 49ebe6e

Please sign in to comment.