Add error handling for missing xattr

Previously this prevented listing inside a directory when using file
systems like HFS and NFS.  References gaul/s3proxy#279.
This commit is contained in:
Andrew Gaul 2019-01-04 11:40:10 -08:00
parent f8e7222143
commit ba9d02f7f9
1 changed files with 5 additions and 1 deletions

View File

@ -709,7 +709,11 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
if (!exists && getDirectoryBlobSuffix(tokens[tokens.length - 1]) != null if (!exists && getDirectoryBlobSuffix(tokens[tokens.length - 1]) != null
&& file.isDirectory()) { && file.isDirectory()) {
UserDefinedFileAttributeView view = getUserDefinedFileAttributeView(file.toPath()); UserDefinedFileAttributeView view = getUserDefinedFileAttributeView(file.toPath());
exists = view != null && view.list().contains(XATTR_CONTENT_MD5); try {
exists = view != null && view.list().contains(XATTR_CONTENT_MD5);
} catch (IOException ioe) {
logger.debug("xattrs not supported on %s", file.toPath());
}
} }
return exists; return exists;
} }