diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cd3b7841..e8a6fb7cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to Gogs are documented in this file. - _Security:_ Cross-repository LFS object overwrite via missing content hash verification. [#8166](https://github.com/gogs/gogs/pull/8166) - [GHSA-gmf8-978x-2fg2](https://github.com/gogs/gogs/security/advisories/GHSA-gmf8-978x-2fg2) - _Security:_ DOM-based XSS via issue meta selection on the issue page. [#8178](https://github.com/gogs/gogs/pull/8178) - [GHSA-vgjm-2cpf-4g7c](https://github.com/gogs/gogs/security/advisories/GHSA-vgjm-2cpf-4g7c) +- Unable to update files via web editor and API. [#8184](https://github.com/gogs/gogs/pull/8184) ### Removed diff --git a/go.mod b/go.mod index 2be75579a..8ef60c460 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/go-macaron/toolbox v0.0.0-20190813233741-94defb8383c6 github.com/gogs/chardet v0.0.0-20150115103509-2404f7772561 github.com/gogs/cron v0.0.0-20171120032916-9f6c956d3e14 - github.com/gogs/git-module v1.8.6 + github.com/gogs/git-module v1.8.7 github.com/gogs/go-libravatar v0.0.0-20191106065024-33a75213d0a0 github.com/gogs/minwinsvc v0.0.0-20170301035411-95be6356811a github.com/google/go-github v17.0.0+incompatible diff --git a/go.sum b/go.sum index 0065666bb..191856215 100644 --- a/go.sum +++ b/go.sum @@ -142,8 +142,8 @@ github.com/gogs/chardet v0.0.0-20150115103509-2404f7772561 h1:aBzukfDxQlCTVS0NBU github.com/gogs/chardet v0.0.0-20150115103509-2404f7772561/go.mod h1:Pcatq5tYkCW2Q6yrR2VRHlbHpZ/R4/7qyL1TCF7vl14= github.com/gogs/cron v0.0.0-20171120032916-9f6c956d3e14 h1:yXtpJr/LV6PFu4nTLgfjQdcMdzjbqqXMEnHfq0Or6p8= github.com/gogs/cron v0.0.0-20171120032916-9f6c956d3e14/go.mod h1:jPoNZLWDAqA5N3G5amEoiNbhVrmM+ZQEcnQvNQ2KaZk= -github.com/gogs/git-module v1.8.6 h1:4Io9vWZYQyIjdIPxfKgeYZXnDKNgydc6OZTxII5xCH4= -github.com/gogs/git-module v1.8.6/go.mod h1:IiMSJqi8XH62Kjqjt5Rw8IawSo+DHfM2dDjkSzWLjhs= +github.com/gogs/git-module v1.8.7 h1:GDyfzB1Z8ytld3LajTfUE4PuIcGcuCHpWB6j8/oD7Tk= +github.com/gogs/git-module v1.8.7/go.mod h1:IiMSJqi8XH62Kjqjt5Rw8IawSo+DHfM2dDjkSzWLjhs= github.com/gogs/go-libravatar v0.0.0-20191106065024-33a75213d0a0 h1:K02vod+sn3M1OOkdqi2tPxN2+xESK4qyITVQ3JkGEv4= github.com/gogs/go-libravatar v0.0.0-20191106065024-33a75213d0a0/go.mod h1:Zas3BtO88pk1cwUfEYlvnl/CRwh0ybDxRWSwRjG8I3w= github.com/gogs/minwinsvc v0.0.0-20170301035411-95be6356811a h1:8DZwxETOVWIinYxDK+i6L+rMb7eGATGaakD6ZucfHVk= diff --git a/internal/database/webhook_dingtalk.go b/internal/database/webhook_dingtalk.go index bdc724235..500b20fa3 100644 --- a/internal/database/webhook_dingtalk.go +++ b/internal/database/webhook_dingtalk.go @@ -133,7 +133,7 @@ func getDingtalkPushPayload(p *apiv1types.WebhookPushPayload) *DingtalkPayload { for i, commit := range p.Commits { msg := strings.Split(commit.Message, "\n")[0] commitLink := MarkdownLinkFormatter(commit.URL, commit.ID[:7]) - detail.WriteString(fmt.Sprintf("> %d. %s %s - %s\n", i, commitLink, commit.Author.Name, msg)) + fmt.Fprintf(&detail, "> %d. %s %s - %s\n", i, commitLink, commit.Author.Name, msg) } actionCard := NewDingtalkActionCard("View Changes", p.CompareURL) diff --git a/internal/database/webhook_discord.go b/internal/database/webhook_discord.go index f16eac2c3..2ea40b157 100644 --- a/internal/database/webhook_discord.go +++ b/internal/database/webhook_discord.go @@ -140,11 +140,11 @@ func getDiscordPushPayload(p *apiv1types.WebhookPushPayload, slack *SlackMeta) * repoLink := DiscordLinkFormatter(p.Repo.HTMLURL, p.Repo.Name) branchLink := DiscordLinkFormatter(p.Repo.HTMLURL+"/src/"+branchName, branchName) var content strings.Builder - content.WriteString(fmt.Sprintf("Pushed %s to %s/%s\n", commitString, repoLink, branchLink)) + fmt.Fprintf(&content, "Pushed %s to %s/%s\n", commitString, repoLink, branchLink) // for each commit, generate attachment text for i, commit := range p.Commits { - content.WriteString(fmt.Sprintf("%s %s - %s", DiscordSHALinkFormatter(commit.URL, commit.ID[:7]), DiscordTextFormatter(commit.Message), commit.Author.Name)) + fmt.Fprintf(&content, "%s %s - %s", DiscordSHALinkFormatter(commit.URL, commit.ID[:7]), DiscordTextFormatter(commit.Message), commit.Author.Name) // add linebreak to each commit but the last if i < len(p.Commits)-1 { content.WriteString("\n") diff --git a/internal/database/webhook_slack.go b/internal/database/webhook_slack.go index 8b53383c5..b07d98d9b 100644 --- a/internal/database/webhook_slack.go +++ b/internal/database/webhook_slack.go @@ -123,7 +123,7 @@ func getSlackPushPayload(p *apiv1types.WebhookPushPayload, slack *SlackMeta) *Sl var attachmentText strings.Builder // for each commit, generate attachment text for i, commit := range p.Commits { - attachmentText.WriteString(fmt.Sprintf("%s: %s - %s", SlackLinkFormatter(commit.URL, commit.ID[:7]), SlackShortTextFormatter(commit.Message), SlackTextFormatter(commit.Author.Name))) + fmt.Fprintf(&attachmentText, "%s: %s - %s", SlackLinkFormatter(commit.URL, commit.ID[:7]), SlackShortTextFormatter(commit.Message), SlackTextFormatter(commit.Author.Name)) // add linebreak to each commit but the last if i < len(p.Commits)-1 { attachmentText.WriteString("\n") diff --git a/internal/route/repo/view.go b/internal/route/repo/view.go index 8edc6cbf1..2dfa33e7c 100644 --- a/internal/route/repo/view.go +++ b/internal/route/repo/view.go @@ -181,7 +181,7 @@ func renderFile(c *context.Context, entry *git.TreeEntry, treeLink, rawLink stri output.Reset() for i := 0; i < len(lines); i++ { - output.WriteString(fmt.Sprintf(`%d`, i+1, i+1)) + fmt.Fprintf(&output, `%d`, i+1, i+1) } c.Data["LineNums"] = gotemplate.HTML(output.String()) }