aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/storage/workspaces/httpworkspaces.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2026-02-04 13:20:20 +0100
committerGitHub Enterprise <[email protected]>2026-02-04 13:20:20 +0100
commit05108dad394952733838daf442ffdd553a62b727 (patch)
tree8fd64eb6ba26e93da5b1a165750a9f7ad2fc67de /src/zenserver/storage/workspaces/httpworkspaces.cpp
parentimplemented chunking for TransmitFile path (#736) (diff)
downloadzen-05108dad394952733838daf442ffdd553a62b727.tar.xz
zen-05108dad394952733838daf442ffdd553a62b727.zip
use matcher over regex (#744)
* replace http router AddPattern with AddMatcher * fix scrub logging
Diffstat (limited to 'src/zenserver/storage/workspaces/httpworkspaces.cpp')
-rw-r--r--src/zenserver/storage/workspaces/httpworkspaces.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/zenserver/storage/workspaces/httpworkspaces.cpp b/src/zenserver/storage/workspaces/httpworkspaces.cpp
index 3fea46b2f..dc4cc7e69 100644
--- a/src/zenserver/storage/workspaces/httpworkspaces.cpp
+++ b/src/zenserver/storage/workspaces/httpworkspaces.cpp
@@ -169,10 +169,20 @@ HttpWorkspacesService::Initialize()
ZEN_LOG_INFO(LogFs, "Initializing Workspaces Service");
- m_Router.AddPattern("workspace_id", "([[:xdigit:]]{24})");
- m_Router.AddPattern("share_id", "([[:xdigit:]]{24})");
- m_Router.AddPattern("chunk", "([[:xdigit:]]{24})");
- m_Router.AddPattern("share_alias", "([[:alnum:]_.\\+\\-\\[\\]]+)");
+ static constexpr AsciiSet ValidHexCharactersSet{"0123456789abcdefABCDEF"};
+
+ m_Router.AddMatcher("workspace_id", [](std::string_view Str) -> bool {
+ return Str.length() == Oid::StringLength && AsciiSet::HasOnly(Str, ValidHexCharactersSet);
+ });
+ m_Router.AddMatcher("share_id", [](std::string_view Str) -> bool {
+ return Str.length() == Oid::StringLength && AsciiSet::HasOnly(Str, ValidHexCharactersSet);
+ });
+ m_Router.AddMatcher("chunk", [](std::string_view Str) -> bool {
+ return Str.length() == Oid::StringLength && AsciiSet::HasOnly(Str, ValidHexCharactersSet);
+ });
+ m_Router.AddMatcher("share_alias", [](std::string_view Str) -> bool {
+ return !Str.empty() && AsciiSet::HasOnly(Str, Workspaces::ValidAliasCharactersSet);
+ });
m_Router.RegisterRoute(
"{workspace_id}/{share_id}/files",