aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-01-22 15:27:09 +0100
committerGitHub Enterprise <[email protected]>2025-01-22 15:27:09 +0100
commitdd1c78c66de731306c06e8cfefcdb778d46bfcce (patch)
tree04a1a7c178c43666de7f7f9b472ed156f6373da5
parentAdd multithreading directory scanning in core/filesystem (#277) (diff)
downloadzen-dd1c78c66de731306c06e8cfefcdb778d46bfcce.tar.xz
zen-dd1c78c66de731306c06e8cfefcdb778d46bfcce.zip
handle special backslash followed by quote for paths (#279)
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/zen/cmds/workspaces_cmd.cpp20
2 files changed, 17 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7f5e43ec8..38b152f8a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,7 @@
- Bugfix: Add missing Lua mapping option to `--statsd` command line option
- Bugfix: Verify that chunking is allowed before chunking loose files duriung oplog export
- Bugfix: Fix oplog target url for oplog export to remote zenserver
+- Bugfix: Handle workspace share paths enclosed in quotes and ending with backslash UE-231677
## 5.5.17
- Improvement: Batch fetch record attachments when appropriate
diff --git a/src/zen/cmds/workspaces_cmd.cpp b/src/zen/cmds/workspaces_cmd.cpp
index 2c8fe43f6..05d3c573f 100644
--- a/src/zen/cmds/workspaces_cmd.cpp
+++ b/src/zen/cmds/workspaces_cmd.cpp
@@ -22,11 +22,23 @@ namespace zen {
namespace {
static void RemoveTrailingPathSeparator(std::filesystem::path& Path)
{
- std::u8string PathString = Path.u8string();
- if (PathString.ends_with(std::filesystem::path::preferred_separator))
+ if (!Path.empty())
{
- PathString.pop_back();
- Path = std::filesystem::path(PathString);
+ std::u8string PathString = Path.u8string();
+ if (PathString.ends_with(std::filesystem::path::preferred_separator))
+ {
+ PathString.pop_back();
+ Path = std::filesystem::path(PathString);
+ }
+ // Special case if user gives a path with quotes and includes a backslash at the end:
+ // ="path\" cxxopts strips the leading quote only but not the trailing.
+ // As we expect paths here and we don't want trailing slashes we strip away the quote
+ // manually if the string does not start with a quote UE-231677
+ else if (PathString[0] != '\"' && PathString[PathString.length() - 1] == '\"')
+ {
+ PathString.pop_back();
+ Path = std::filesystem::path(PathString);
+ }
}
}