Closed vpont closed 3 years ago
Interesting, that's some really unfortunate behavior. I took a brief look at the code and it looks like as long as the OneDrive API allows creating a directory on top of an existing directory, the filesystem will just happily overwrite the existing directory in-place. I'll add some tests and fix this for the future.
Note that any lost files from this should still be available in the OneDrive Recycle Bin (you can view this in the OneDrive web UI).
This is fixed now in #161.
One thing worth noting is that the final command in the test case mv /tmp/testdir ~/OneDrive/
is an "inter-device move" which mv
treats differently than a normal move. Instead of merging the directory contents, mv
will attempt to delete the destination directory before moving the source directory to the new location.
In this case, instead of merging the contents of the two directories, the correct behavior is for the mv
command to fail when attempting to delete ~/OneDrive/testdir
(because the destination directory is nonempty). The filesystem should do this properly now.
When moving a directory to one with the same name inside OneDrive's drive it will replace it instead of merging the files from both directories (as any other filesystem in Linux would do).
It can be reproduced as follows:
After this, only
file2
will survive.