feat: add chunk file upload

This commit is contained in:
yangshangbo
2025-07-10 10:03:57 +08:00
parent 684866baa6
commit d59c268492
15 changed files with 2394 additions and 13 deletions
+4 -4
View File
@@ -52,7 +52,7 @@ pub fn (mut tr ContextTrieRouter) add_route(method string, path string, handler
}
segments := path.split('/').filter(it != '')
mut current := tr.method_trees[method]
mut current := tr.method_trees[method] or { return }
for i, seg in segments {
if seg.starts_with(':') {
@@ -72,7 +72,7 @@ pub fn (mut tr ContextTrieRouter) add_route(method string, path string, handler
if seg !in current.children {
current.children[seg] = ContextTrieNode.new(seg, TrieNodeType.static, '')
}
current = current.children[seg]
current = current.children[seg] or { return }
}
// 在最后一个节点设置处理器
@@ -94,13 +94,13 @@ pub fn (mut tr ContextTrieRouter) match_route(method string, path string) ?Conte
}
segments := path.split('/').filter(it != '')
mut current := tr.method_trees[method]
mut current := tr.method_trees[method] or { return none }
mut params := map[string]string{}
for seg in segments {
// 先尝试静态匹配
if seg in current.children {
current = current.children[seg]
current = current.children[seg] or { return none }
} else if current.param_child != unsafe { nil } {
// 参数匹配
params[current.param_child.param_name] = seg