summaryrefslogtreecommitdiffstats
path: root/modules/context/repo.go
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2017-11-04 01:23:59 +0200
committerGitHub <noreply@github.com>2017-11-04 01:23:59 +0200
commit08b124dd47e5be365ac843031ed3ea73d1fbc151 (patch)
tree7e818a82feb5c0606be99d56cce9f7109b999473 /modules/context/repo.go
parente6bb8e7a4da2c4e10b54099756192351ff20b677 (diff)
downloadgitea-08b124dd47e5be365ac843031ed3ea73d1fbc151.tar.gz
gitea-08b124dd47e5be365ac843031ed3ea73d1fbc151.zip
Fix API raw requests for commits and tags (#2841)
Diffstat (limited to 'modules/context/repo.go')
-rw-r--r--modules/context/repo.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go
index 8e0c584c82..850b127e59 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -466,6 +466,9 @@ const (
// RepoRefLegacy unknown type, make educated guess and redirect.
// for backward compatibility with previous URL scheme
RepoRefLegacy RepoRefType = iota
+ // RepoRefAny is for usage where educated guess is needed
+ // but redirect can not be made
+ RepoRefAny
// RepoRefBranch branch
RepoRefBranch
// RepoRefTag tag
@@ -497,7 +500,7 @@ func getRefNameFromPath(ctx *Context, path string, isExist func(string) bool) st
func getRefName(ctx *Context, pathType RepoRefType) string {
path := ctx.Params("*")
switch pathType {
- case RepoRefLegacy:
+ case RepoRefLegacy, RepoRefAny:
if refName := getRefName(ctx, RepoRefBranch); len(refName) > 0 {
return refName
}