drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.55k stars 1.11k forks source link

unittest HttpFile failed in windows #1187

Open hks2002 opened 2 years ago

hks2002 commented 2 years ago

Describe the bug

To Reproduce Steps to reproduce the behavior:

  1. Open Developer PowerShell for Visual Studio.
  2. Go to build directory.
  3. conan install .. -s compiler="Visual Studio" -s compiler.version=16 -s build_type=Debug --settings arch=x86_64 -g cmake_paths
  4. cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DBUILD_DROGON_SHARED=OFF -DBUILD_CTL=ON -DBUILD_EXAMPLES=ON -DCMAKE_TOOLCHAIN_FILE="conan_paths.cmake"
  5. cmake --build . --target RUN_TESTS

Screenshots

    filesystem::path fsSaveToPath(filesystem::weakly_canonical(
        fsUploadDir / utils::toNativePath(fileName_)));
    LOG_INFO << "fsSaveToPath:" << fsSaveToPath;
    LOG_INFO << "fsUploadDir:" << fsUploadDir;
    if (!std::equal(fsUploadDir.begin(),
                    fsUploadDir.end(),
                    fsSaveToPath.begin()))
    {
        LOG_ERROR
            << "Attempt writing outside of upload directory detected. Path: "
            << fileName_;
        return -1;
    }
20220304 17:19:10.995000 UTC 6692 INFO  fsSaveToPath:D:\drogon\build\lib\tests\test_uploads_dir\test_file_name - D:\drogon\lib\src\HttpFileImpl.cc:62
20220304 17:19:10.995000 UTC 6692 INFO  fsUploadDir:test_uploads_dir - D:\drogon\lib\src\HttpFileImpl.cc:63
WMRamadan commented 2 years ago

Can you give a little information as to the operating system you are running this on, if its Windows 10 or Windows 11?

hks2002 commented 2 years ago

My computer is windows 11