Skip to content

Commit

Permalink
owncloud driver: Close files before we rename them (cs3org#296)
Browse files Browse the repository at this point in the history
This fixes renaming on operation systems with file locking
  • Loading branch information
TheOneRing authored and labkode committed Oct 15, 2019
1 parent e5837ff commit 3a03735
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/storage/fs/owncloud/owncloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -959,10 +959,10 @@ func (fs *ocFS) Upload(ctx context.Context, ref *storageproviderv0alphapb.Refere
if err != nil {
return errors.Wrap(err, "ocFS: error creating tmp fn at "+path.Dir(np))
}
defer tmp.Close()
defer os.RemoveAll(tmp.Name())

_, err = io.Copy(tmp, r)
tmp.Close()
if err != nil {
return errors.Wrap(err, "ocFS: error writing to tmp file "+tmp.Name())
}
Expand Down

0 comments on commit 3a03735

Please sign in to comment.