Skip to content

Commit

Permalink
Merge branch 'master' into imap
Browse files Browse the repository at this point in the history
* master:
  Use Request.URL.RequestURI() for fcgi (go-gitea#14312) (go-gitea#14314)
  Update Link
  [skip ci] Updated translations via Crowdin
  Kd/add bountysource (go-gitea#14323)
  • Loading branch information
a1012112796 committed Jan 14, 2021
2 parents 074e6d2 + edbc5c8 commit 4baedb5
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
open_collective: gitea
custom: https://www.bountysource.com/teams/gitea
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
<a href="https://www.tickgit.com/browse?repo=github.com/go-gitea/gitea" title="TODOs">
<img src="https://badgen.net/https/api.tickgit.com/badgen/github.com/go-gitea/gitea">
</a>
<a href="https://www.bountysource.com/teams/gitea" title="Bountysource">
<img src="https://img.shields.io/bountysource/team/gitea/activity">
</a>
</p>

<p align="center">
Expand Down
3 changes: 3 additions & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
<a href="https://www.tickgit.com/browse?repo=github.com/go-gitea/gitea" title="TODOs">
<img src="https://badgen.net/https/api.tickgit.com/badgen/github.com/go-gitea/gitea">
</a>
<a href="https://img.shields.io/bountysource/team/gitea" title="Bountysource">
<img src="https://img.shields.io/bountysource/team/gitea/activity">
</a>
</p>

<p align="center">
Expand Down
2 changes: 1 addition & 1 deletion custom/conf/app.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ MACARON = file
ROUTER_LOG_LEVEL = Info
ROUTER = console
ENABLE_ACCESS_LOG = false
ACCESS_LOG_TEMPLATE = {{.Ctx.RemoteAddr}} - {{.Identity}} {{.Start.Format "[02/Jan/2006:15:04:05 -0700]" }} "{{.Ctx.Req.Method}} {{.Ctx.Req.RequestURI}} {{.Ctx.Req.Proto}}" {{.ResponseWriter.Status}} {{.ResponseWriter.Size}} "{{.Ctx.Req.Referer}}\" \"{{.Ctx.Req.UserAgent}}"
ACCESS_LOG_TEMPLATE = {{.Ctx.RemoteAddr}} - {{.Identity}} {{.Start.Format "[02/Jan/2006:15:04:05 -0700]" }} "{{.Ctx.Req.Method}} {{.Ctx.Req.URL.RequestURI}} {{.Ctx.Req.Proto}}" {{.ResponseWriter.Status}} {{.ResponseWriter.Size}} "{{.Ctx.Req.Referer}}\" \"{{.Ctx.Req.UserAgent}}"
ACCESS = file
; Either "Trace", "Debug", "Info", "Warn", "Error", "Critical", default is "Trace"
LEVEL = Info
Expand Down
2 changes: 2 additions & 0 deletions options/locale/locale_zh-TW.ini
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,8 @@ tag=標籤
released_this=發佈了此版本
file_raw=原始文件
file_history=歷史記錄
file_view_source=檢視原始碼
file_view_rendered=檢視渲染圖
file_view_raw=查看原始文件
file_permalink=永久連結
file_too_large=檔案太大,無法顯示。
Expand Down
12 changes: 6 additions & 6 deletions routers/routes/chi.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ func LoggerHandler(level log.Level) func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
start := time.Now()

_ = log.GetLogger("router").Log(0, level, "Started %s %s for %s", log.ColoredMethod(req.Method), req.RequestURI, req.RemoteAddr)
_ = log.GetLogger("router").Log(0, level, "Started %s %s for %s", log.ColoredMethod(req.Method), req.URL.RequestURI(), req.RemoteAddr)

next.ServeHTTP(w, req)

ww := middleware.NewWrapResponseWriter(w, req.ProtoMajor)

status := ww.Status()
_ = log.GetLogger("router").Log(0, level, "Completed %s %s %v %s in %v", log.ColoredMethod(req.Method), req.RequestURI, log.ColoredStatus(status), log.ColoredStatus(status, http.StatusText(status)), log.ColoredTime(time.Since(start)))
_ = log.GetLogger("router").Log(0, level, "Completed %s %s %v %s in %v", log.ColoredMethod(req.Method), req.URL.RequestURI(), log.ColoredStatus(status), log.ColoredStatus(status, http.StatusText(status)), log.ColoredTime(time.Since(start)))
})
}
}
Expand All @@ -107,12 +107,12 @@ func storageHandler(storageSetting setting.Storage, prefix string, objStore stor
return
}

if !strings.HasPrefix(req.RequestURI, "/"+prefix) {
if !strings.HasPrefix(req.URL.RequestURI(), "/"+prefix) {
next.ServeHTTP(w, req)
return
}

rPath := strings.TrimPrefix(req.RequestURI, "/"+prefix)
rPath := strings.TrimPrefix(req.URL.RequestURI(), "/"+prefix)
u, err := objStore.URL(rPath, path.Base(rPath))
if err != nil {
if os.IsNotExist(err) || errors.Is(err, os.ErrNotExist) {
Expand All @@ -139,12 +139,12 @@ func storageHandler(storageSetting setting.Storage, prefix string, objStore stor
return
}

if !strings.HasPrefix(req.RequestURI, "/"+prefix) {
if !strings.HasPrefix(req.URL.RequestURI(), "/"+prefix) {
next.ServeHTTP(w, req)
return
}

rPath := strings.TrimPrefix(req.RequestURI, "/"+prefix)
rPath := strings.TrimPrefix(req.URL.RequestURI(), "/"+prefix)
rPath = strings.TrimPrefix(rPath, "/")

fi, err := objStore.Stat(rPath)
Expand Down

0 comments on commit 4baedb5

Please sign in to comment.