mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 17:41:57 +08:00
Modify: add unique index for folder & file
This commit is contained in:
@@ -42,7 +42,7 @@ func (fs *FileSystem) AddFile(ctx context.Context, parent *model.Folder) (*model
|
||||
Size: file.GetSize(),
|
||||
FolderID: parent.ID,
|
||||
PolicyID: fs.User.Policy.ID,
|
||||
//Dir: parent.PositionAbsolute,
|
||||
Dir: parent.PositionAbsolute,
|
||||
}
|
||||
_, err := newFile.Create()
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestFileSystem_AddFile(t *testing.T) {
|
||||
Model: gorm.Model{
|
||||
ID: 1,
|
||||
},
|
||||
Position: "/",
|
||||
PositionAbsolute: "/我的文件",
|
||||
}
|
||||
fs := FileSystem{
|
||||
User: &model.User{
|
||||
|
||||
@@ -177,13 +177,11 @@ func (fs *FileSystem) List(ctx context.Context, dirPath string, pathProcessor fu
|
||||
}
|
||||
|
||||
for _, file := range childFiles {
|
||||
filePath := path.Join(folder.Position, folder.Name, file.Name)
|
||||
|
||||
if processedPath == "" {
|
||||
if pathProcessor != nil {
|
||||
processedPath = pathProcessor(filePath)
|
||||
processedPath = pathProcessor(file.Dir)
|
||||
} else {
|
||||
processedPath = filePath
|
||||
processedPath = file.Dir
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user