diff --git a/internal/app/entity/matter_env.go b/internal/app/entity/matter_env.go index db51050..f6a966f 100644 --- a/internal/app/entity/matter_env.go +++ b/internal/app/entity/matter_env.go @@ -4,6 +4,7 @@ import ( "fmt" "path/filepath" "strconv" + "strings" "time" "github.com/google/uuid" @@ -28,7 +29,7 @@ var SupportEnvs = []MatterEnv{ {Name: "$UUID", Intro: "UUID", Example: "6ba7b810-9dad-11d1-80b4-00c04fd430c8", builder: func(m *Matter) string { return uuid.New().String() }}, {Name: "$RAW_PATH", Intro: "初始上传路径", Example: "文稿/简历", builder: func(m *Matter) string { return m.Parent }}, {Name: "$RAW_NAME", Intro: "初始文件名", Example: "张三-简历", builder: func(m *Matter) string { return m.Name }}, - {Name: "$RAW_EXT", Intro: "初始文件后缀", Example: "pdf", builder: func(m *Matter) string { return filepath.Ext(m.Name)[1:] }}, + {Name: "$RAW_EXT", Intro: "初始文件后缀", Example: "pdf", builder: func(m *Matter) string { return strings.TrimPrefix(filepath.Ext(m.Name), ".") }}, {Name: "$RAND_8KEY", Intro: "8位随机字符", Example: "mCUoR35r", builder: func(m *Matter) string { return strutil.RandomText(8) }}, {Name: "$RAND_16KEY", Intro: "16位随机字符", Example: "e1CbDUNfyVP3sScJ", builder: func(m *Matter) string { return strutil.RandomText(16) }}, {Name: "$NOW_DATE", Intro: "当前时间-日期", Example: "20210101", builder: func(m *Matter) string { return timeutil.Format(time.Now(), "YYYYMMDD") }},