From 8ee9955c8a7f1c5c3d7d2c0de1651979f2daaef9 Mon Sep 17 00:00:00 2001 From: sulenn <273409891@qq.com> Date: Fri, 22 May 2020 15:30:17 +0800 Subject: [PATCH] modify info --- modules/repofiles/content.go | 2 +- modules/structs/repo_file.go | 4 +--- routers/api/v1/api.go | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/repofiles/content.go b/modules/repofiles/content.go index 5127fc353..424ddff63 100644 --- a/modules/repofiles/content.go +++ b/modules/repofiles/content.go @@ -112,7 +112,7 @@ func GetContentsOrList(repo *models.Repository, treePath, ref string) (interface fileContentResponse.LatestCommit = api.ContentsResponseCommit{ Message: entryCommit.CommitMessage, LatestCommitSha: entryCommit.ID.String(), - Time: entryCommit.Author.When, + Time: entryCommit.Author.When.Unix(), } break } diff --git a/modules/structs/repo_file.go b/modules/structs/repo_file.go index 24424f646..a1e2b0659 100644 --- a/modules/structs/repo_file.go +++ b/modules/structs/repo_file.go @@ -5,8 +5,6 @@ package structs -import "time" - // FileOptions options for all file APIs type FileOptions struct { // message (optional) for the commit of this file. if not supplied, a default message will be used @@ -61,7 +59,7 @@ type FileLinksResponse struct { type ContentsResponseCommit struct { Message string `json:"message"` LatestCommitSha string `json:"sha"` - Time time.Time `json:"time"` + Created int64 `json:"created"` } //end by qiubing diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 15b59a531..d0a10f003 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -654,7 +654,7 @@ func RegisterRoutes(m *macaron.Macaron) { // add by qiubing m.Get("/graph", repo.GetGraph) - m.Get("/commits/diff/:sha([a-f0-9]{7,40})$", repo.Diff) + m.Get("/commits/:sha([a-f0-9]{7,40})$/diff", repo.Diff) m.Group("/blame", func() { m.Get("/branch/*", context.RepoRefByType(context.RepoRefBranch), repo.RefBlame) m.Get("/tag/*", context.RepoRefByType(context.RepoRefTag), repo.RefBlame)