From 5e1cbefbcf4f4f4a773fdd35479f0d89e8705245 Mon Sep 17 00:00:00 2001 From: Illyoung Choi Date: Tue, 24 Oct 2023 08:33:05 -0700 Subject: [PATCH] Fix GetBasename bug --- commons/path.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/commons/path.go b/commons/path.go index b00769f..0ac40ad 100644 --- a/commons/path.go +++ b/commons/path.go @@ -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, "/")