mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-29 20:31:56 +08:00
Feat: support {ext} and {uuid} magic variable
This commit is contained in:
2
assets
2
assets
Submodule assets updated: 1a47ca8674...1f4883774a
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user