diff options
author | Zettat123 <zettat123@gmail.com> | 2024-10-18 10:36:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-18 10:36:23 +0800 |
commit | 99cac1f50c4bceb8b28979caeea4af9e5129e85e (patch) | |
tree | 372413bdbf4cc4d18d79bf1fdc1ad08307ded8b3 /models | |
parent | 2a99607add16cf7459429bdc4d2674b2b4ffdf8a (diff) | |
download | gitea-99cac1f50c4bceb8b28979caeea4af9e5129e85e.tar.gz gitea-99cac1f50c4bceb8b28979caeea4af9e5129e85e.zip |
Always update expiration time when creating an artifact (#32281) (#32285)
Backport #32281
Fix #32256
Diffstat (limited to 'models')
-rw-r--r-- | models/actions/artifact.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/models/actions/artifact.go b/models/actions/artifact.go index 3d0a288e62..0bc66ba24e 100644 --- a/models/actions/artifact.go +++ b/models/actions/artifact.go @@ -69,7 +69,7 @@ func CreateArtifact(ctx context.Context, t *ActionTask, artifactName, artifactPa OwnerID: t.OwnerID, CommitSHA: t.CommitSHA, Status: int64(ArtifactStatusUploadPending), - ExpiredUnix: timeutil.TimeStamp(time.Now().Unix() + 3600*24*expiredDays), + ExpiredUnix: timeutil.TimeStamp(time.Now().Unix() + timeutil.Day*expiredDays), } if _, err := db.GetEngine(ctx).Insert(artifact); err != nil { return nil, err @@ -78,6 +78,13 @@ func CreateArtifact(ctx context.Context, t *ActionTask, artifactName, artifactPa } else if err != nil { return nil, err } + + if _, err := db.GetEngine(ctx).ID(artifact.ID).Cols("expired_unix").Update(&ActionArtifact{ + ExpiredUnix: timeutil.TimeStamp(time.Now().Unix() + timeutil.Day*expiredDays), + }); err != nil { + return nil, err + } + return artifact, nil } |