don't remove directory if it's a blob

the filesystem blob store was always removing a/ when a/b was
removed, even if the client explicitly created a/. this patch
fixes that
This commit is contained in:
Ka-Hing Cheung 2015-11-20 17:27:19 -08:00
parent 2dd231b02b
commit ca70d44143
1 changed files with 10 additions and 0 deletions

View File

@ -794,6 +794,16 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
if (!isNullOrEmpty(parentPath)) {
// remove parent directory only it's empty
File directory = new File(buildPathStartingFromBaseDir(container, parentPath));
// don't delete directory if it's a directory blob
try {
UserDefinedFileAttributeView view = getUserDefinedFileAttributeView(directory.toPath());
if (!view.list().isEmpty()) {
return;
}
} catch (IOException e) {
logger.debug("Could not look for attributes from %s: %s", directory, e);
}
String[] children = directory.list();
if (null == children || children.length == 0) {
try {