mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	commit raw file
This commit is contained in:
		| @@ -53,7 +53,7 @@ func IsTextFile(data []byte) (string, bool) { | |||||||
|  |  | ||||||
| func IsImageFile(data []byte) (string, bool) { | func IsImageFile(data []byte) (string, bool) { | ||||||
| 	contentType := http.DetectContentType(data) | 	contentType := http.DetectContentType(data) | ||||||
| 	if strings.Index(contentType, "img/") != -1 { | 	if strings.Index(contentType, "image/") != -1 { | ||||||
| 		return contentType, true | 		return contentType, true | ||||||
| 	} | 	} | ||||||
| 	return contentType, false | 	return contentType, false | ||||||
|   | |||||||
| @@ -225,8 +225,18 @@ func SingleDownload(ctx *middleware.Context, params martini.Params) { | |||||||
| 	// Get tree path | 	// Get tree path | ||||||
| 	treename := params["_1"] | 	treename := params["_1"] | ||||||
|  |  | ||||||
| 	repoFile, err := models.GetTargetFile(params["username"], params["reponame"], | 	branchName := params["branchname"] | ||||||
| 		params["branchname"], params["commitid"], treename) | 	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 { | 	if err != nil { | ||||||
| 		ctx.Handle(404, "repo.SingleDownload(GetTargetFile)", err) | 		ctx.Handle(404, "repo.SingleDownload(GetTargetFile)", err) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user