Skip to content

Commit

Permalink
Fix GetBasename bug
Browse files Browse the repository at this point in the history
  • Loading branch information
iychoi committed Oct 24, 2023
1 parent 78100cb commit 5e1cbef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions commons/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ func GetFileExtension(p string) string {
}

func GetBasename(p string) string {
p = strings.TrimRight(p, string(os.PathSeparator))
p = strings.TrimRight(p, "/")

idx1 := strings.LastIndex(p, string(os.PathSeparator))
idx2 := strings.LastIndex(p, "/")

Expand Down

0 comments on commit 5e1cbef

Please sign in to comment.