Feat: support {ext} and {uuid} magic variable

This commit is contained in:
HFO4
2022-03-23 19:26:25 +08:00
parent eaa8c9e12d
commit 5a3ea89866
2 changed files with 4 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ package model
import (
"encoding/gob"
"encoding/json"
"github.com/gofrs/uuid"
"path"
"path/filepath"
"strconv"
@@ -170,6 +171,8 @@ func (policy *Policy) GenerateFileName(uid uint, origin string) string {
"{minute}": time.Now().Format("04"),
"{second}": time.Now().Format("05"),
"{originname}": origin,
"{ext}": filepath.Ext(origin),
"{uuid}": uuid.Must(uuid.NewV4()).String(),
}
fileRule = util.Replace(replaceTable, fileRule)