Monorepo for Tangled tangled.org

knotserver/internal: fix repo compare URL

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 <me@thecoded.prof>

Changed files
+4 -4
knotserver
+4 -4
knotserver/internal.go
··· 121 121 } 122 122 123 123 if (line.NewSha.String() != line.OldSha.String()) && line.OldSha.IsZero() { 124 - msg, err := h.replyCompare(line, gitUserDid, gitRelativeDir, repoName, r.Context()) 124 + msg, err := h.replyCompare(line, repoDid, gitRelativeDir, repoName, r.Context()) 125 125 if err != nil { 126 126 l.Error("failed to reply with compare link", "err", err, "line", line, "did", gitUserDid, "repo", gitRelativeDir) 127 127 // non-fatal ··· 142 142 writeJSON(w, resp) 143 143 } 144 144 145 - func (h *InternalHandle) replyCompare(line git.PostReceiveLine, gitUserDid string, gitRelativeDir string, repoName string, ctx context.Context) ([]string, error) { 145 + func (h *InternalHandle) replyCompare(line git.PostReceiveLine, repoOwner string, gitRelativeDir string, repoName string, ctx context.Context) ([]string, error) { 146 146 l := h.l.With("handler", "replyCompare") 147 - userIdent, err := idresolver.DefaultResolver().ResolveIdent(ctx, gitUserDid) 148 - user := gitUserDid 147 + userIdent, err := idresolver.DefaultResolver().ResolveIdent(ctx, repoOwner) 148 + user := repoOwner 149 149 if err != nil { 150 150 l.Error("Failed to fetch user identity", "err", err) 151 151 // non-fatal