-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix s3 doesDirectoryExist check for empty directories #22747
Conversation
LGTM 👍 Which s3 implementation does not work correctly? As flysystem is using a similar approach I would like to port this fix. Edit: Is the marker object something Nextcloud specific? Then a port is not necessary I guess. Empty folders may not exist in s3 world. |
Unfortunately this doesn't yet work as expected. I've pushed another commit to basically only match directories, otherwise when uploading a file to an empty directory the new file would be detected as a folder.
@icewind1991 and me reproduced this on minio.
This actually still seems to be an issue, once you delete the last file in a directory the path will also be become unavailable on the storage of course, while it still is part of the filecache, but will get removed on the next check if it is a directory. |
Ok this now seems to do the trick for the file upload part into an empty directory. Deletion are a separate topic I'd say. |
2105bb9
to
8d70ce9
Compare
Squashed my commits into one additional, mind to have another look if that makes sense to you as well @kesselb @icewind1991 ? |
👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐘
if a directory is empty, only the 'marker' object `/` exists. since not all s3 implementations return just the prefix when listing objects by prefix, when listing objects by the folder prefix, nothing will be returned if the directory is empty. by not including the trailing slash in the prefix, the folder marked will always be returned if it exists Signed-off-by: Robin Appelman <robin@icewind.nl>
…ermined Signed-off-by: Julius Härtl <jus@bitgrid.net>
8d70ce9
to
2004ae4
Compare
🤖 beep boop beep 🤖 Here are the logs for the failed build: Status of 32917: failuremysql8.0-php7.2Show full log
acceptance-app-files-sharing
Show full log
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐘
@icewind1991 @juliushaertl Backport? |
/backport to stable19 |
/backport to stable18 |
if a directory is empty, only the 'marker' object
/
exists.since not all s3 implementations return just the prefix when listing objects by prefix,
when listing objects by the folder prefix, nothing will be returned if the directory is empty.
by not including the trailing slash in the prefix, the folder marked will always be returned if it exists
Signed-off-by: Robin Appelman robin@icewind.nl