Browse Source

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>
pull/35875/head
Divyun Raje Vaid 1 month ago committed by GitHub
parent
commit
61e5cc173e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      routers/api/v1/repo/file.go

8
routers/api/v1/repo/file.go

@ -370,11 +370,11 @@ func ReqChangeRepoFileOptionsAndCheck(ctx *context.APIContext) { @@ -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
}

Loading…
Cancel
Save