summaryrefslogtreecommitdiffstats
path: root/services/auth/auth.go
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2024-02-24 06:47:11 +0800
committerGitHub <noreply@github.com>2024-02-23 23:47:11 +0100
commit829b807a91f9895e3f4b262f688a8d0d9a44caf6 (patch)
treec96d681ad7a330f58542dc10aaa9be8be04a7eff /services/auth/auth.go
parent874cdcc9743d7eae85f42f9f3eec3b6e677e67c0 (diff)
downloadgitea-829b807a91f9895e3f4b262f688a8d0d9a44caf6.tar.gz
gitea-829b807a91f9895e3f4b262f688a8d0d9a44caf6.zip
Fix tarball/zipball download bug (#29342) (#29352)
Backport #29342 by @Zettat123 Fix #29249 ~~Use the `/repos/{owner}/{repo}/archive/{archive}` API to download.~~ Apply #26430 to archive download URLs. Co-authored-by: Zettat123 <zettat123@gmail.com>
Diffstat (limited to 'services/auth/auth.go')
-rw-r--r--services/auth/auth.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/services/auth/auth.go b/services/auth/auth.go
index 713463a3d4..2d43707518 100644
--- a/services/auth/auth.go
+++ b/services/auth/auth.go
@@ -38,6 +38,7 @@ func isContainerPath(req *http.Request) bool {
var (
gitRawOrAttachPathRe = regexp.MustCompile(`^/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+/(?:(?:git-(?:(?:upload)|(?:receive))-pack$)|(?:info/refs$)|(?:HEAD$)|(?:objects/)|(?:raw/)|(?:releases/download/)|(?:attachments/))`)
lfsPathRe = regexp.MustCompile(`^/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+/info/lfs/`)
+ archivePathRe = regexp.MustCompile(`^/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+/archive/`)
)
func isGitRawOrAttachPath(req *http.Request) bool {
@@ -54,6 +55,10 @@ func isGitRawOrAttachOrLFSPath(req *http.Request) bool {
return false
}
+func isArchivePath(req *http.Request) bool {
+ return archivePathRe.MatchString(req.URL.Path)
+}
+
// handleSignIn clears existing session variables and stores new ones for the specified user object
func handleSignIn(resp http.ResponseWriter, req *http.Request, sess SessionStore, user *user_model.User) {
// We need to regenerate the session...