forked from forgejo/forgejo
Replace ServeStream
with ServeContent
(#20903)
* Replace ServeStream with ServeContent. * Update modules/timeutil/timestamp.go Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
5e232e86de
commit
dc0253b063
17 changed files with 31 additions and 41 deletions
|
@ -475,7 +475,7 @@ func downloadFile(ctx *context.Context, fileFilter stringSet, fileKey string) {
|
|||
}
|
||||
defer s.Close()
|
||||
|
||||
ctx.ServeStream(s, pf.Name)
|
||||
ctx.ServeContent(pf.Name, s, pf.CreatedUnix.AsLocalTime())
|
||||
}
|
||||
|
||||
// DeleteRecipeV1 deletes the requested recipe(s)
|
||||
|
@ -723,7 +723,7 @@ func listRevisions(ctx *context.Context, revisions []*conan_model.PropertyValue)
|
|||
|
||||
revs := make([]*revisionInfo, 0, len(revisions))
|
||||
for _, rev := range revisions {
|
||||
revs = append(revs, &revisionInfo{Revision: rev.Value, Time: time.Unix(int64(rev.CreatedUnix), 0)})
|
||||
revs = append(revs, &revisionInfo{Revision: rev.Value, Time: rev.CreatedUnix.AsLocalTime()})
|
||||
}
|
||||
|
||||
jsonResponse(ctx, http.StatusOK, &RevisionList{revs})
|
||||
|
@ -743,7 +743,7 @@ func LatestRecipeRevision(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
jsonResponse(ctx, http.StatusOK, &revisionInfo{Revision: revision.Value, Time: time.Unix(int64(revision.CreatedUnix), 0)})
|
||||
jsonResponse(ctx, http.StatusOK, &revisionInfo{Revision: revision.Value, Time: revision.CreatedUnix.AsLocalTime()})
|
||||
}
|
||||
|
||||
// LatestPackageRevision gets the latest package revision
|
||||
|
@ -760,7 +760,7 @@ func LatestPackageRevision(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
jsonResponse(ctx, http.StatusOK, &revisionInfo{Revision: revision.Value, Time: time.Unix(int64(revision.CreatedUnix), 0)})
|
||||
jsonResponse(ctx, http.StatusOK, &revisionInfo{Revision: revision.Value, Time: revision.CreatedUnix.AsLocalTime()})
|
||||
}
|
||||
|
||||
// ListRecipeRevisionFiles gets a list of all recipe revision files
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue