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

pull/1198/head
HFO4 3 years ago
parent eaa8c9e12d
commit 5a3ea89866

@ -1 +1 @@
Subproject commit 1a47ca8674654a2507fc77764b3ac1f295b04cad Subproject commit 1f4883774ab9fc24685a4adf8099e38e7daf67c8

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

Loading…
Cancel
Save