0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-11-08 20:58:09 -05:00

fix(api/repo/contents): set the dates to now when not specified by the caller (#35861)

Since 1.25.0, the dates get set to `2001-01-01T00:00:00Z`, when not
specified by the caller.

Fixes #35860

Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
Divyun Raje Vaid
2025-11-06 00:22:24 +05:30
committed by GitHub
parent 84d7496b9d
commit 61e5cc173e

View File

@@ -370,11 +370,11 @@ func ReqChangeRepoFileOptionsAndCheck(ctx *context.APIContext) {
},
Signoff: commonOpts.Signoff,
}
if commonOpts.Dates.Author.IsZero() {
commonOpts.Dates.Author = time.Now()
if changeFileOpts.Dates.Author.IsZero() {
changeFileOpts.Dates.Author = time.Now()
}
if commonOpts.Dates.Committer.IsZero() {
commonOpts.Dates.Committer = time.Now()
if changeFileOpts.Dates.Committer.IsZero() {
changeFileOpts.Dates.Committer = time.Now()
}
ctx.Data["__APIChangeRepoFilesOptions"] = changeFileOpts
}