Commits


Thomas Newton authored and GitHub committed 8a62f30d34a
GH-40037: [C++][FS][Azure] Make attempted reads and writes against directories fail fast (#40119) ### Rationale for this change Prevent confusion if a user attempts to read or write a directory. ### What changes are included in this PR? - Make `ObjectAppendStream::Flush` a noop if `ObjectAppendStream::Init` has not run successfully. This avoids an unhandled error when the destructor calls flush. - Check blob properties for directory marker metadata when initialising `ObjectInputFile` or `ObjectAppendStream`. - When initialising `ObjectAppendStream` call `GetFileInfo` if it is a flat namespace account. ### Are these changes tested? Add new tests `DisallowReadingOrWritingDirectoryMarkers` and `DisallowCreatingFileAndDirectoryWithTheSameName` to cover the new fail fast behaviour. Also updated `WriteMetadata` to ensure that my changes to Flush didn't break setting metadata without calling `Write` on the stream. ### Are there any user-facing changes? Yes. Invalid read and write operations will now fail fast and gracefully. Previously could get into a confusing state where there were files and directories at the same path and there were some un-graceful failures. * Closes: #40037 Authored-by: Thomas Newton <thomas.w.newton@gmail.com> Signed-off-by: Felipe Oliveira Carvalho <felipekde@gmail.com>