Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions cpp/src/arrow/filesystem/s3fs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3117,6 +3117,18 @@ Result<FileInfo> S3FileSystem::GetFileInfo(const std::string& s) {
if (outcome.IsSuccess()) {
// "File" object found
FileObjectToInfo(path.key, outcome.GetResult(), &info);
if (info.type() == FileType::File && info.size() == 0) {
// GH-24093: some third-party tools create zero-byte "directory marker"
// objects that use neither a trailing slash nor the conventional
// "application/x-directory" content type, so IsDirectory() above
// doesn't recognize them. If other objects exist nested under this
// key, treat it as a directory rather than an (invalid) empty file.
ARROW_ASSIGN_OR_RAISE(bool is_dir, impl_->IsNonEmptyDirectory(path));
if (is_dir) {
info.set_type(FileType::Directory);
info.set_size(kNoSize);
}
}
return info;
}
impl_->GetOrSetBackend(outcome.GetError());
Expand Down