From 7e64392bb71c5a006f2fbe009de20b17a6e7ce56 Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Tue, 18 Aug 2026 20:31:00 +0200 Subject: [PATCH] graph: inline the children-POST defer condition at its use --- services/graph/pkg/middleware/path_lookup.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/services/graph/pkg/middleware/path_lookup.go b/services/graph/pkg/middleware/path_lookup.go index 26bff20cee..a3e85eee6d 100644 --- a/services/graph/pkg/middleware/path_lookup.go +++ b/services/graph/pkg/middleware/path_lookup.go @@ -190,10 +190,6 @@ func rewriteColonPath( return "", "", nil } - // The colon path addresses the parent of the item a POST .../children - // creates; the handler decides how to resolve it. - deferToHandler := method == http.MethodPost && match.suffix == "/children" - // RoutePath follows chi's RawPath, i.e. the percent-encoded wire form // (e.g. "/Documents/My%20File"). A single PathUnescape reproduces exactly // what net/http put in r.URL.Path; it is NOT a double-decode (a crafted @@ -245,8 +241,9 @@ func rewriteColonPath( return "", "", errInvalidRequest } - if deferToHandler { - // rewrite to the anchor item, the handler resolves the parent path + if method == http.MethodPost && match.suffix == "/children" { + // the colon path addresses the parent of the item to create: rewrite + // to the anchor item, the handler resolves the parent path if anchor.GetOpaqueId() == "" { // the space root item id is storage$space!space anchor.OpaqueId = anchor.GetSpaceId()