Skip to content

Commit

Permalink
fix: update while moving
Browse files Browse the repository at this point in the history
  • Loading branch information
bhunter234 committed Jan 26, 2025
1 parent 5cb07b2 commit e73c11b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion backend/teldrive/teldrive.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ func (f *Fs) findObject(ctx context.Context, pathID, leaf string) ([]api.FileInf
return info.Files, nil
}

func (f *Fs) moveTo(ctx context.Context, id, _, dstLeaf, srcDirectoryID, dstDirectoryID string) error {
func (f *Fs) moveTo(ctx context.Context, id, srcLeaf, dstLeaf, srcDirectoryID, dstDirectoryID string) error {

if srcDirectoryID != dstDirectoryID {
opts := rest.Opts{
Expand All @@ -570,6 +570,13 @@ func (f *Fs) moveTo(ctx context.Context, id, _, dstLeaf, srcDirectoryID, dstDire
if err != nil {
return fmt.Errorf("couldn't move file: %w", err)
}
} else {
if srcLeaf != dstLeaf {
err := f.updateFileInformation(ctx, &api.UpdateFileInformation{Name: dstLeaf}, id)
if err != nil {
return fmt.Errorf("move: failed rename: %w", err)
}
}
}

return nil
Expand Down

0 comments on commit e73c11b

Please sign in to comment.