mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Fix: test failed due to Policy.AutoName
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/HFO4/cloudreve/pkg/util"
|
||||
"github.com/gin-gonic/gin"
|
||||
"io"
|
||||
"path"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
@@ -165,3 +166,13 @@ func (fs *FileSystem) IsPathExist(path string) bool {
|
||||
_, err := model.GetFolderByPath(path, fs.User.ID)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// IsFileExist 返回给定路径的文件是否存在
|
||||
func (fs *FileSystem) IsFileExist(fullPath string) bool {
|
||||
basePath := path.Dir(fullPath)
|
||||
fileName := path.Base(fullPath)
|
||||
|
||||
_, err := model.GetFileByPathAndName(basePath, fileName, fs.User.ID)
|
||||
|
||||
return err == nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user