aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-02-24 12:38:18 +0100
committerGitHub Enterprise <[email protected]>2025-02-24 12:38:18 +0100
commit574c62a94f61265be5ae3d086834fa8b9d29eefc (patch)
treef17d65fffe1e761686be94a650f11afb0d4585f2
parentmove WriteToTempFile to basicfile.h (#283) (diff)
downloadzen-574c62a94f61265be5ae3d086834fa8b9d29eefc.tar.xz
zen-574c62a94f61265be5ae3d086834fa8b9d29eefc.zip
strip leading path separator when creating workspace shares (#285)
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/zen/cmds/workspaces_cmd.cpp16
2 files changed, 16 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 38b152f8a..d73c5954b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
- 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
+- Bugfix: Strip leading path separator when creating workspace shares
## 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 05d3c573f..166d4218d 100644
--- a/src/zen/cmds/workspaces_cmd.cpp
+++ b/src/zen/cmds/workspaces_cmd.cpp
@@ -25,7 +25,7 @@ namespace {
if (!Path.empty())
{
std::u8string PathString = Path.u8string();
- if (PathString.ends_with(std::filesystem::path::preferred_separator))
+ if (PathString.ends_with(std::filesystem::path::preferred_separator) || PathString.ends_with('/'))
{
PathString.pop_back();
Path = std::filesystem::path(PathString);
@@ -42,6 +42,19 @@ namespace {
}
}
+ static void RemoveLeadingPathSeparator(std::filesystem::path& Path)
+ {
+ if (!Path.empty())
+ {
+ std::u8string PathString = Path.u8string();
+ if (PathString.starts_with(std::filesystem::path::preferred_separator) || PathString.starts_with('/'))
+ {
+ PathString.erase(PathString.begin());
+ Path = std::filesystem::path(PathString);
+ }
+ }
+ }
+
void ShowShare(const Workspaces::WorkspaceShareConfiguration& Share, const Oid& WorkspaceId, std::string_view Prefix)
{
ZEN_CONSOLE("{}Id: {}", Prefix, Share.Id);
@@ -451,6 +464,7 @@ WorkspaceShareCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char**
}
RemoveTrailingPathSeparator(m_SharePath);
+ RemoveLeadingPathSeparator(m_SharePath);
if (m_ShareId.empty())
{