diff --git a/routers/web/feed/convert.go b/routers/web/feed/convert.go index 7b09c92ee5..c492b9c586 100644 --- a/routers/web/feed/convert.go +++ b/routers/web/feed/convert.go @@ -224,7 +224,7 @@ func feedActionsToFeedItems(ctx *context.Context, actions activities_model.Actio } if push.Len > 1 { - link = &feeds.Link{Href: fmt.Sprintf("%s/%s", setting.AppSubURL, push.CompareURL)} + link = &feeds.Link{Href: setting.AppURL + push.CompareURL} } else if push.Len == 1 { link = &feeds.Link{Href: fmt.Sprintf("%s/commit/%s", act.GetRepoAbsoluteLink(ctx), push.Commits[0].Sha1)} } diff --git a/tests/integration/feed_user_test.go b/tests/integration/feed_user_test.go index 2bc9e99290..e6b8971728 100644 --- a/tests/integration/feed_user_test.go +++ b/tests/integration/feed_user_test.go @@ -61,6 +61,8 @@ func TestFeed(t *testing.T) { err := xml.Unmarshal(resp.Body.Bytes(), &rss) require.NoError(t, err) assert.Contains(t, rss.Channel.Link, "/user2") + assert.NotEmpty(t, rss.Channel.Items) + assert.Regexp(t, `http://localhost:\d+/user2/repo1/compare/ed4090`, rss.Channel.Items[0].Link) assert.NotEmpty(t, rss.Channel.PubDate) }) }) diff --git a/tests/integration/fixtures/TestFeed/action.yml b/tests/integration/fixtures/TestFeed/action.yml index 160f7cb63a..6458951e61 100644 --- a/tests/integration/fixtures/TestFeed/action.yml +++ b/tests/integration/fixtures/TestFeed/action.yml @@ -16,3 +16,14 @@ is_private: false created_unix: 1680454039 content: '["1","Well, this test is short | succinct | distinct."]' + +# a multi-commit push to validate the format of the generated compare URLs, see #10168 +- id: 1003 + user_id: 2 + op_type: 5 # commit repo + act_user_id: 2 + comment_id: 0 + repo_id: 1 # public + is_private: false + created_unix: 1680454039 + content: '{"Commits":[{"Sha1":"412413fd409fc0cab446e7b59702596e1bde1816","Message":"fourth commit","AuthorEmail":"git@example.com","AuthorName":"dummy","CommitterEmail":"git@example.com","CommitterName":"dummy","Signature":null,"Verification":null,"Timestamp":"2026-01-19T22:07:22+01:00"},{"Sha1":"00a01802439eb2c0391fdfaa2c344b5e25d0b9d4","Message":"third commit","AuthorEmail":"git@example.com","AuthorName":"dummy","CommitterEmail":"git@example.com","CommitterName":"dummy","Signature":null,"Verification":null,"Timestamp":"2026-01-19T22:07:18+01:00"}],"HeadCommit":{"Sha1":"412413fd409fc0cab446e7b59702596e1bde1816","Message":"fourth commit","AuthorEmail":"git@example.com","AuthorName":"dummy","CommitterEmail":"git@example.com","CommitterName":"dummy","Signature":null,"Verification":null,"Timestamp":"2026-01-19T22:07:22+01:00"},"CompareURL":"user2/repo1/compare/ed4090ecc2d9dd16b184763cc476ea1b28afa560...412413fd409fc0cab446e7b59702596e1bde1816","Len":2}'