From 4b3c9f65f61d06a6206d8f217327ed33c867e4c1 Mon Sep 17 00:00:00 2001 From: Samuel Shuert Date: Sat, 11 Oct 2025 19:18:09 +0000 Subject: [PATCH] knotserver/internal: fix repo compare URL Change-Id: rnxqpqxpwuktzpztpvxplvtllpqzponq Before this we incorrectly assumed that the git user Did was the same as the repo Did, this is not the case. We now take the repo Did as an argument to the replyCompare function Signed-off-by: Samuel Shuert --- knotserver/internal.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/knotserver/internal.go b/knotserver/internal.go index e87dd984..98d5d162 100644 --- a/knotserver/internal.go +++ b/knotserver/internal.go @@ -121,7 +121,7 @@ func (h *InternalHandle) PostReceiveHook(w http.ResponseWriter, r *http.Request) } if (line.NewSha.String() != line.OldSha.String()) && line.OldSha.IsZero() { - msg, err := h.replyCompare(line, gitUserDid, gitRelativeDir, repoName, r.Context()) + msg, err := h.replyCompare(line, repoDid, gitRelativeDir, repoName, r.Context()) if err != nil { l.Error("failed to reply with compare link", "err", err, "line", line, "did", gitUserDid, "repo", gitRelativeDir) // non-fatal @@ -142,10 +142,10 @@ func (h *InternalHandle) PostReceiveHook(w http.ResponseWriter, r *http.Request) writeJSON(w, resp) } -func (h *InternalHandle) replyCompare(line git.PostReceiveLine, gitUserDid string, gitRelativeDir string, repoName string, ctx context.Context) ([]string, error) { +func (h *InternalHandle) replyCompare(line git.PostReceiveLine, repoOwner string, gitRelativeDir string, repoName string, ctx context.Context) ([]string, error) { l := h.l.With("handler", "replyCompare") - userIdent, err := idresolver.DefaultResolver().ResolveIdent(ctx, gitUserDid) - user := gitUserDid + userIdent, err := idresolver.DefaultResolver().ResolveIdent(ctx, repoOwner) + user := repoOwner if err != nil { l.Error("Failed to fetch user identity", "err", err) // non-fatal -- 2.43.0