-
Notifications
You must be signed in to change notification settings - Fork 186
Closed
Description
Seen that behaviour twice already.
I've code to delete folder from DiskShare.
But if I'm open DiskEntry with empty file path and then will call rmDir(), library deletes all files from that DiskShare.
Kotlin Code:
val share: DiskShare = session?.connectShare(FOLDER_MEDIA) as DiskShare
var diskEntry: DiskEntry? = null
try {
assertIsSafeToDelete(path)
diskEntry = share.open(
"",
EnumSet.of(AccessMask.FILE_DELETE_CHILD),
EnumSet.of(FileAttributes.FILE_ATTRIBUTE_DIRECTORY),
SMB2ShareAccess.ALL,
SMB2CreateDisposition.FILE_OPEN,
Collections.singleton(SMB2CreateOptions.FILE_DIRECTORY_FILE)
)
diskEntry.diskShare.rmdir(path, true)
Timber.d("deleteFile(), diskEntry: %s", diskEntry)
} finally {
closeSafely(diskEntry)
}
I'm expecting exception here on share.open() as object not exists ... or something similar.
Or fail of rmDir() call. But definitely not delete all.
Library version: 0.11.5
Samba version: 4.15.13-Ubuntu
Server version: Ubuntu 22.04.1
User has read-write permission
Metadata
Metadata
Assignees
Labels
No labels