Skip to content

Commit

Permalink
gogs/gogs#2373 500 when filename starts with ':'
Browse files Browse the repository at this point in the history
  • Loading branch information
unknwon committed Jan 11, 2016
1 parent 2617983 commit 081966e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions git.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"time"
)

const _VERSION = "0.2.2"
const _VERSION = "0.2.3"

func Version() string {
return _VERSION
Expand All @@ -20,7 +20,7 @@ var (
// Debug enables verbose logging on everything.
// This should be false in case Gogs starts in SSH mode.
Debug = false
Prefix = "[git-shell] "
Prefix = "[git-module] "
)

func log(format string, args ...interface{}) {
Expand Down
5 changes: 5 additions & 0 deletions repo_commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ func (repo *Repository) GetTagCommit(name string) (*Commit, error) {
}

func (repo *Repository) getCommitByPathWithID(id sha1, relpath string) (*Commit, error) {
// File name starts with ':' must be escaped.
if relpath[0] == ':' {
relpath = `\` + relpath
}

stdout, err := NewCommand("log", "-1", _PRETTY_LOG_FORMAT, id.String(), "--", relpath).RunInDir(repo.Path)
if err != nil {
return nil, err
Expand Down

0 comments on commit 081966e

Please sign in to comment.