Browse Source

commit raw file

tags/v1.2.0-rc1
slene 11 years ago
parent
commit
10b412d237
2 changed files with 13 additions and 3 deletions
  1. +1
    -1
      modules/base/markdown.go
  2. +12
    -2
      routers/repo/repo.go

+ 1
- 1
modules/base/markdown.go View File

@@ -53,7 +53,7 @@ func IsTextFile(data []byte) (string, bool) {

func IsImageFile(data []byte) (string, bool) {
contentType := http.DetectContentType(data)
if strings.Index(contentType, "img/") != -1 {
if strings.Index(contentType, "image/") != -1 {
return contentType, true
}
return contentType, false


+ 12
- 2
routers/repo/repo.go View File

@@ -225,8 +225,18 @@ func SingleDownload(ctx *middleware.Context, params martini.Params) {
// Get tree path
treename := params["_1"]

repoFile, err := models.GetTargetFile(params["username"], params["reponame"],
params["branchname"], params["commitid"], treename)
branchName := params["branchname"]
userName := params["username"]
repoName := params["reponame"]

var commitId string
if !models.IsBranchExist(userName, repoName, branchName) {
commitId = branchName
branchName = ""
}

repoFile, err := models.GetTargetFile(userName, repoName,
branchName, commitId, treename)

if err != nil {
ctx.Handle(404, "repo.SingleDownload(GetTargetFile)", err)


Loading…
Cancel
Save