diff --git a/src/libcommonserver/io/iohelper.cpp b/src/libcommonserver/io/iohelper.cpp index cb8fd8de8..a653afc1a 100644 --- a/src/libcommonserver/io/iohelper.cpp +++ b/src/libcommonserver/io/iohelper.cpp @@ -63,6 +63,7 @@ IoError IoHelper::stdError2ioError(int error) noexcept { case static_cast(std::errc::is_a_directory): return IoErrorIsADirectory; case static_cast(std::errc::no_such_file_or_directory): + case static_cast(std::errc::not_a_directory): // Occurs in particular when converting a bundle into a single file return IoErrorNoSuchFileOrDirectory; case static_cast(std::errc::no_space_on_device): return IoErrorDiskFull; diff --git a/test/libcommonserver/io/testcheckifpathexists.cpp b/test/libcommonserver/io/testcheckifpathexists.cpp index ad1a2636e..b5d24434d 100644 --- a/test/libcommonserver/io/testcheckifpathexists.cpp +++ b/test/libcommonserver/io/testcheckifpathexists.cpp @@ -454,6 +454,17 @@ void TestIo::testCheckIfPathExistsWithSameNodeIdAllBranches() { _testObj->resetFunctions(); } + + // Checking existence of a subdirectory inside a directory that have been deleted and replaced with a file with the same name + // ex: conversion of a bundle into a single file (macOS) + { + const SyncPath path = _localTestDirPath / "test_pictures/picture-1.jpg/A"; + bool exists = false; + IoError ioError = IoErrorUnknown; + CPPUNIT_ASSERT(_testObj->checkIfPathExists(path, exists, ioError)); + CPPUNIT_ASSERT(!exists); + CPPUNIT_ASSERT_EQUAL(IoErrorNoSuchFileOrDirectory, ioError); + } }