diff options
| author | zousar <[email protected]> | 2026-03-18 10:04:37 -0600 |
|---|---|---|
| committer | zousar <[email protected]> | 2026-03-18 10:04:37 -0600 |
| commit | a192118b1a6f27c55c5b716642fa14f162c5eafe (patch) | |
| tree | eb0b32c022bf250607d73b69c3cdce1b16745859 /src | |
| parent | Merge branch 'main' into zs/long-filename-improvement (diff) | |
| download | zen-a192118b1a6f27c55c5b716642fa14f162c5eafe.tar.xz zen-a192118b1a6f27c55c5b716642fa14f162c5eafe.zip | |
Addressing review feedback
Diffstat (limited to 'src')
| -rw-r--r-- | src/zenserver/storage/projectstore/httpprojectstore.cpp | 10 | ||||
| -rw-r--r-- | src/zenstore/projectstore.cpp | 3 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/zenserver/storage/projectstore/httpprojectstore.cpp b/src/zenserver/storage/projectstore/httpprojectstore.cpp index 3bde082e5..425caee97 100644 --- a/src/zenserver/storage/projectstore/httpprojectstore.cpp +++ b/src/zenserver/storage/projectstore/httpprojectstore.cpp @@ -3163,8 +3163,8 @@ HttpProjectService::HandleRpcRequest(HttpRouterRequest& Req) std::error_code Ec; // Long paths require MakeSafeAbsolutePath otherwise canonical will yield an error code - const std::filesystem::path FilePath = - std::filesystem::canonical(MakeSafeAbsolutePath(Project->RootDir / ServerPath), Ec); + const std::filesystem::path SafeAbsFilePath = MakeSafeAbsolutePath(Project->RootDir / ServerPath); + const std::filesystem::path FilePath = std::filesystem::canonical(SafeAbsFilePath, Ec); if (Ec) { @@ -3185,10 +3185,8 @@ HttpProjectService::HandleRpcRequest(HttpRouterRequest& Req) } BasicFile DataFile; - // Even after calling MakeSafeAbsolutePath on the input to canonical, we will fail to read - // long paths for the output of canonical unless we make them safe here again, because the - // output of canonical will have stripped things like the leading characters to handle long paths - DataFile.Open(MakeSafeAbsolutePath(FilePath), BasicFile::Mode::kRead, Ec); + // Must use SafeAbsFilePath because canonical will have removed leading chars for handling long paths + DataFile.Open(SafeAbsFilePath, BasicFile::Mode::kRead, Ec); if (Ec) { diff --git a/src/zenstore/projectstore.cpp b/src/zenstore/projectstore.cpp index 54fd2b789..56d0f7d2b 100644 --- a/src/zenstore/projectstore.cpp +++ b/src/zenstore/projectstore.cpp @@ -2520,10 +2520,11 @@ ProjectStore::Oplog::FindChunk(const std::filesystem::path& ProjectRootDir, cons if (auto FileIt = m_FileMap.find(ChunkId); FileIt != m_FileMap.end()) { std::filesystem::path FilePath = ProjectRootDir / FileIt->second.ServerPath; - MakeSafeAbsolutePathInPlace(FilePath); OplogLock.ReleaseNow(); + MakeSafeAbsolutePathInPlace(FilePath); + IoBuffer Result = IoBufferBuilder::MakeFromFile(FilePath); if (!Result) { |