mirror of https://github.com/gogs/gogs.git
wiki: fix crash with blob name contains tab (#3916)
parent
f129e0ecb5
commit
3b49a99b60
6
Makefile
6
Makefile
|
@ -70,11 +70,11 @@ test:
|
|||
go test -cover -race ./...
|
||||
|
||||
fixme:
|
||||
grep -rnw "FIXME" routers models modules
|
||||
grep -rnw "FIXME" cmd routers models modules
|
||||
|
||||
todo:
|
||||
grep -rnw "TODO" routers models modules
|
||||
grep -rnw "TODO" cmd routers models modules
|
||||
|
||||
# Legacy code should be remove by the time of release
|
||||
legacy:
|
||||
grep -rnw "LEGACY" routers models modules
|
||||
grep -rnw "LEGACY" cmd routers models modules
|
||||
|
|
|
@ -95,7 +95,7 @@ func checkVersion() {
|
|||
{"github.com/go-macaron/toolbox", toolbox.Version, "0.1.0"},
|
||||
{"gopkg.in/ini.v1", ini.Version, "1.8.4"},
|
||||
{"gopkg.in/macaron.v1", macaron.Version, "1.1.7"},
|
||||
{"github.com/gogits/git-module", git.Version, "0.4.8"},
|
||||
{"github.com/gogits/git-module", git.Version, "0.4.9"},
|
||||
{"github.com/gogits/go-gogs-client", gogs.Version, "0.12.1"},
|
||||
}
|
||||
for _, c := range checkers {
|
||||
|
|
|
@ -4,7 +4,7 @@ Package git-module is a Go module for Git access through shell commands.
|
|||
|
||||
## Limitations
|
||||
|
||||
- Go version must be at least **1.3**.
|
||||
- Go version must be at least **1.4**.
|
||||
- Git version must be no less than **1.7.1**, and greater than or equal to **1.8.0** is recommended.
|
||||
- For Windows users, try use as new a version as possible.
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
const _VERSION = "0.4.8"
|
||||
const _VERSION = "0.4.9"
|
||||
|
||||
func Version() string {
|
||||
return _VERSION
|
||||
|
|
|
@ -29,25 +29,23 @@ func NewTree(repo *Repository, id sha1) *Tree {
|
|||
}
|
||||
}
|
||||
|
||||
var escapeChar = []byte("\\")
|
||||
// Predefine []byte variables to avoid runtime allocations.
|
||||
var (
|
||||
escapedSlash = []byte(`\\`)
|
||||
regularSlash = []byte(`\`)
|
||||
escapedTab = []byte(`\t`)
|
||||
regularTab = []byte("\t")
|
||||
)
|
||||
|
||||
// UnescapeChars reverses escaped characters.
|
||||
func UnescapeChars(in []byte) []byte {
|
||||
if bytes.Index(in, escapeChar) == -1 {
|
||||
// LEGACY [Go 1.7]: use more expressive bytes.ContainsAny
|
||||
if bytes.IndexAny(in, "\\\t") == -1 {
|
||||
return in
|
||||
}
|
||||
|
||||
endIdx := len(in) - 1
|
||||
isEscape := false
|
||||
out := make([]byte, 0, endIdx+1)
|
||||
for i := range in {
|
||||
if in[i] == '\\' && !isEscape {
|
||||
isEscape = true
|
||||
continue
|
||||
}
|
||||
isEscape = false
|
||||
out = append(out, in[i])
|
||||
}
|
||||
out := bytes.Replace(in, escapedSlash, regularSlash, -1)
|
||||
out = bytes.Replace(out, escapedTab, regularTab, -1)
|
||||
return out
|
||||
}
|
||||
|
||||
|
|
|
@ -159,10 +159,10 @@
|
|||
"revisionTime": "2016-08-10T03:50:02Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "PvpYCMEys67XcZPCZR27tRjnkHY=",
|
||||
"checksumSHA1": "RSr3IvGo5PFxAP3ybtDcEojTWPI=",
|
||||
"path": "github.com/gogits/git-module",
|
||||
"revision": "a6d3c3660265eece3a34aef4f6ec4ce29b543294",
|
||||
"revisionTime": "2017-02-15T23:32:44Z"
|
||||
"revision": "41f3ca26f6b202c82d022a1062f7b7ea6339924b",
|
||||
"revisionTime": "2017-02-16T16:46:07Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "xvG+RgJODQqlmdAkHUQK2TyLR88=",
|
||||
|
|
Loading…
Reference in New Issue