mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-28 02:41:57 +08:00
Feat: support {ext} and {uuid} magic variable
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user