Description of the bug
If you delete a folder on a WebDAV share, it can also delete another folder sitting right next to it when the two names start the same way. I deleted TestBug and TestBugfoo went with it. I never touched TestBugfoo, it just vanished. This is on S3, and from reading the code Azure looks the same.
The reason is that Windows (and some other clients) send the delete without a trailing slash on the folder. On S3 a folder delete works by listing everything that starts with that path and removing all of it, so it lists with a prefix of TestBug and that also catches TestBugfoo. Move works the same way, so moving a folder can drag the neighbours along and rename them into a mess.
The normal web interface is fine because it always puts the trailing slash on directories. It only goes wrong when something sends the folder path without it, which is exactly what Windows does over WebDAV.
I had a look at the other backends too. Azure does the same thing in code so it should have the same problem. Backblaze is a bit different since it uses a delimiter. The rest seem ok, the filesystem ones delete properly, dropbox and gdrive go by exact path or id, and the remote webdav one just forwards the request to the server.
Step by step instructions to reproduce the bug
- Set up a share on an S3 backend
- Mount it as a network drive in Windows
- Make two folders next to each other where one name is the start of the other:
- Delete
TestBug from Windows file explorer
- Refresh,
TestBugfoo should now also be deleted
Can you replicate that error from the demo?
The S3 backend in the demo seems broken but you can do it on any instance quite easily. You need an S3 type backend, and the share has to be mounted over WebDAV (create a share with no password) from something that drops the trailing slash like Windows File Explorer. I hit it on my own S3 setup with Windows file explorer.
Observed behavior
Deleting TestBug also wiped out TestBugfoo. Moving a folder has the same issue.
Expected behavior
Deleting TestBug should only delete TestBug and leave TestBugfoo alone. A folder next to it that happens to start with the same letters should not get touched.
For the fix, the folder delete and move could add the trailing slash to the prefix before listing, the same way Mkdir already does with EnforceDirectory. This needs to be tested, I'll see tomorrow.
Description of the bug
If you delete a folder on a WebDAV share, it can also delete another folder sitting right next to it when the two names start the same way. I deleted
TestBugandTestBugfoowent with it. I never touchedTestBugfoo, it just vanished. This is on S3, and from reading the code Azure looks the same.The reason is that Windows (and some other clients) send the delete without a trailing slash on the folder. On S3 a folder delete works by listing everything that starts with that path and removing all of it, so it lists with a prefix of
TestBugand that also catchesTestBugfoo. Move works the same way, so moving a folder can drag the neighbours along and rename them into a mess.The normal web interface is fine because it always puts the trailing slash on directories. It only goes wrong when something sends the folder path without it, which is exactly what Windows does over WebDAV.
I had a look at the other backends too. Azure does the same thing in code so it should have the same problem. Backblaze is a bit different since it uses a delimiter. The rest seem ok, the filesystem ones delete properly, dropbox and gdrive go by exact path or id, and the remote webdav one just forwards the request to the server.
Step by step instructions to reproduce the bug
TestBugTestBugfooTestBugfrom Windows file explorerTestBugfooshould now also be deletedCan you replicate that error from the demo?
The S3 backend in the demo seems broken but you can do it on any instance quite easily. You need an S3 type backend, and the share has to be mounted over WebDAV (create a share with no password) from something that drops the trailing slash like Windows File Explorer. I hit it on my own S3 setup with Windows file explorer.
Observed behavior
Deleting
TestBugalso wiped outTestBugfoo. Moving a folder has the same issue.Expected behavior
Deleting
TestBugshould only deleteTestBugand leaveTestBugfooalone. A folder next to it that happens to start with the same letters should not get touched.For the fix, the folder delete and move could add the trailing slash to the prefix before listing, the same way
Mkdiralready does withEnforceDirectory. This needs to be tested, I'll see tomorrow.