mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 17:41:57 +08:00
Modify: use path package in app level
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/HFO4/cloudreve/pkg/cache"
|
||||
"github.com/HFO4/cloudreve/pkg/util"
|
||||
"github.com/jinzhu/gorm"
|
||||
"path/filepath"
|
||||
"path"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
@@ -96,7 +96,7 @@ func (policy *Policy) SerializeOptions() (err error) {
|
||||
}
|
||||
|
||||
// GeneratePath 生成存储文件的路径
|
||||
func (policy *Policy) GeneratePath(uid uint, path string) string {
|
||||
func (policy *Policy) GeneratePath(uid uint, origin string) string {
|
||||
dirRule := policy.DirNameRule
|
||||
replaceTable := map[string]string{
|
||||
"{randomkey16}": util.RandStringRunes(16),
|
||||
@@ -105,10 +105,10 @@ func (policy *Policy) GeneratePath(uid uint, path string) string {
|
||||
"{uid}": strconv.Itoa(int(uid)),
|
||||
"{datetime}": time.Now().Format("20060102150405"),
|
||||
"{date}": time.Now().Format("20060102"),
|
||||
"{path}": path + "/",
|
||||
"{path}": origin + "/",
|
||||
}
|
||||
dirRule = util.Replace(replaceTable, dirRule)
|
||||
return filepath.Clean(dirRule)
|
||||
return path.Clean(dirRule)
|
||||
}
|
||||
|
||||
// GenerateFileName 生成存储文件名
|
||||
|
||||
Reference in New Issue
Block a user