aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver
diff options
context:
space:
mode:
authorzousar <[email protected]>2026-03-17 23:44:19 -0600
committerzousar <[email protected]>2026-03-17 23:44:19 -0600
commited8ef5f2ded97d34f0d1bd4a45eca65a73e75eb5 (patch)
tree3db6aa71914289a45b7c449fe735d044f8af893d /src/zenserver
parentAdd tests for long path handling in project store (diff)
downloadzen-ed8ef5f2ded97d34f0d1bd4a45eca65a73e75eb5.tar.xz
zen-ed8ef5f2ded97d34f0d1bd4a45eca65a73e75eb5.zip
Fix long path handling for project store
Diffstat (limited to 'src/zenserver')
-rw-r--r--src/zenserver/storage/projectstore/httpprojectstore.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/zenserver/storage/projectstore/httpprojectstore.cpp b/src/zenserver/storage/projectstore/httpprojectstore.cpp
index 38a121b37..3bde082e5 100644
--- a/src/zenserver/storage/projectstore/httpprojectstore.cpp
+++ b/src/zenserver/storage/projectstore/httpprojectstore.cpp
@@ -3161,8 +3161,10 @@ HttpProjectService::HandleRpcRequest(HttpRouterRequest& Req)
continue;
}
- std::error_code Ec;
- const std::filesystem::path FilePath = std::filesystem::canonical(Project->RootDir / ServerPath, Ec);
+ 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);
if (Ec)
{
@@ -3183,7 +3185,10 @@ HttpProjectService::HandleRpcRequest(HttpRouterRequest& Req)
}
BasicFile DataFile;
- DataFile.Open(FilePath, BasicFile::Mode::kRead, Ec);
+ // 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);
if (Ec)
{