summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--public/ng/css/gogs.css6
-rw-r--r--public/ng/less/gogs/repository.less6
-rw-r--r--routers/repo/http.go41
-rw-r--r--templates/repo/commits_table.tmpl2
4 files changed, 44 insertions, 11 deletions
diff --git a/public/ng/css/gogs.css b/public/ng/css/gogs.css
index 581ec621a7..eb96cb8056 100644
--- a/public/ng/css/gogs.css
+++ b/public/ng/css/gogs.css
@@ -1489,6 +1489,12 @@ The register and sign-in page style
font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace;
font-size: 14px;
}
+.commit-list .message {
+ width: 60%;
+}
+.commit-list .message span {
+ max-width: 500px;
+}
.diff-head-box {
margin-top: 10px;
}
diff --git a/public/ng/less/gogs/repository.less b/public/ng/less/gogs/repository.less
index 8f02fc5846..05e203a774 100644
--- a/public/ng/less/gogs/repository.less
+++ b/public/ng/less/gogs/repository.less
@@ -523,6 +523,12 @@
font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace;
font-size: 14px;
}
+ .message {
+ width: 60%;
+ span {
+ max-width: 500px;
+ }
+ }
}
.diff-head-box {
margin-top: 10px;
diff --git a/routers/repo/http.go b/routers/repo/http.go
index 56c85bf59a..81b49bf309 100644
--- a/routers/repo/http.go
+++ b/routers/repo/http.go
@@ -6,6 +6,7 @@ package repo
import (
"bytes"
+ "compress/gzip"
"encoding/base64"
"errors"
"fmt"
@@ -283,23 +284,42 @@ func serviceReceivePack(hr handler) {
func serviceRpc(rpc string, hr handler) {
w, r, dir := hr.w, hr.r, hr.Dir
- access := hasAccess(r, hr.Config, dir, rpc, true)
+ access := hasAccess(r, hr.Config, dir, rpc, true)
if access == false {
renderNoAccess(w)
return
}
w.Header().Set("Content-Type", fmt.Sprintf("application/x-git-%s-result", rpc))
- w.WriteHeader(http.StatusOK)
- var input []byte
- var br io.Reader
+ var (
+ reqBody = r.Body
+ input []byte
+ br io.Reader
+ err error
+ )
+
+ // Handle GZIP.
+ if r.Header.Get("Content-Encoding") == "gzip" {
+ reqBody, err = gzip.NewReader(reqBody)
+ if err != nil {
+ log.GitLogger.Error(2, "fail to create gzip reader: %v", err)
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
+ }
+
if hr.Config.OnSucceed != nil {
- input, _ = ioutil.ReadAll(r.Body)
+ input, err = ioutil.ReadAll(reqBody)
+ if err != nil {
+ log.GitLogger.Error(2, "fail to read request body: %v", err)
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
br = bytes.NewReader(input)
} else {
- br = r.Body
+ br = reqBody
}
args := []string{rpc, "--stateless-rpc", dir}
@@ -308,15 +328,16 @@ func serviceRpc(rpc string, hr handler) {
cmd.Stdout = w
cmd.Stdin = br
- err := cmd.Run()
- if err != nil {
- log.GitLogger.Error(4, err.Error())
+ if err := cmd.Run(); err != nil {
+ log.GitLogger.Error(2, "fail to serve RPC(%s): %v", rpc, err)
+ w.WriteHeader(http.StatusInternalServerError)
return
}
if hr.Config.OnSucceed != nil {
hr.Config.OnSucceed(rpc, input)
}
+ w.WriteHeader(http.StatusOK)
}
func getInfoRefs(hr handler) {
@@ -372,7 +393,7 @@ func sendFile(contentType string, hr handler) {
w, r := hr.w, hr.r
reqFile := path.Join(hr.Dir, hr.File)
- //fmt.Println("sendFile:", reqFile)
+ // fmt.Println("sendFile:", reqFile)
f, err := os.Stat(reqFile)
if os.IsNotExist(err) {
diff --git a/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl
index 5b9761b165..d48d61a5a7 100644
--- a/templates/repo/commits_table.tmpl
+++ b/templates/repo/commits_table.tmpl
@@ -26,7 +26,7 @@
<tr>
<td class="author"><img class="avatar-20" src="{{AvatarLink .Author.Email}}" alt=""/>&nbsp;&nbsp;&nbsp;{{if .UserName}}<a href="{{AppSubUrl}}/{{.UserName}}">{{.Author.Name}}</a>{{else}}{{.Author.Name}}{{end}}</td>
<td class="sha"><a rel="nofollow" class="label label-green" href="{{AppSubUrl}}/{{$username}}/{{$reponame}}/commit/{{.Id}} ">{{SubStr .Id.String 0 10}} </a></td>
- <td class="message">{{.Summary}} </td>
+ <td class="message"><span class="text-truncate">{{.Summary}}</span></td>
<td class="date">{{TimeSince .Author.When $.Lang}}</td>
</tr>
{{end}}