Skip to content

Commit 154d752

Browse files
GiteaBotdivyun
andauthored
fix(api/repo/contents): set the dates to now when not specified by the caller (#35861) (#35874)
Backport #35861 by @divyun 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: Divyun Raje Vaid <mail@divyun.com>
1 parent 24189dc commit 154d752

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

routers/api/v1/repo/file.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,11 +369,11 @@ func ReqChangeRepoFileOptionsAndCheck(ctx *context.APIContext) {
369369
},
370370
Signoff: commonOpts.Signoff,
371371
}
372-
if commonOpts.Dates.Author.IsZero() {
373-
commonOpts.Dates.Author = time.Now()
372+
if changeFileOpts.Dates.Author.IsZero() {
373+
changeFileOpts.Dates.Author = time.Now()
374374
}
375-
if commonOpts.Dates.Committer.IsZero() {
376-
commonOpts.Dates.Committer = time.Now()
375+
if changeFileOpts.Dates.Committer.IsZero() {
376+
changeFileOpts.Dates.Committer = time.Now()
377377
}
378378
ctx.Data["__APIChangeRepoFilesOptions"] = changeFileOpts
379379
}

0 commit comments

Comments
 (0)