mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -186,6 +186,10 @@ func RemoveFilesWithSoftLinks(files []File) ([]File, error) {
|
||||
// 结果值
|
||||
filteredFiles := make([]File, 0)
|
||||
|
||||
if len(files) == 0 {
|
||||
return filteredFiles, nil
|
||||
}
|
||||
|
||||
// 查询软链接的文件
|
||||
var filesWithSoftLinks []File
|
||||
tx := DB
|
||||
|
||||
@@ -257,6 +257,19 @@ func TestFile_GetPolicy(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemoveFilesWithSoftLinks_EmptyArg(t *testing.T) {
|
||||
asserts := assert.New(t)
|
||||
// 传入空
|
||||
{
|
||||
mock.ExpectQuery("SELECT(.+)files(.+)")
|
||||
file, err := RemoveFilesWithSoftLinks([]File{})
|
||||
asserts.Error(mock.ExpectationsWereMet())
|
||||
asserts.NoError(err)
|
||||
asserts.Equal(len(file), 0)
|
||||
DB.Find(&File{})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemoveFilesWithSoftLinks(t *testing.T) {
|
||||
asserts := assert.New(t)
|
||||
files := []File{
|
||||
|
||||
Reference in New Issue
Block a user