From: Lunny Xiao Date: Fri, 21 Mar 2014 16:50:47 +0000 (+0800) Subject: merged X-Git-Tag: v0.9.99~2385 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=17da2fd2e30e85909394bc58069ecab14d8d8577;p=gitea.git merged --- 17da2fd2e30e85909394bc58069ecab14d8d8577 diff --cc routers/repo/single.go index 064150a234,eab49be919..37c0fabd79 --- a/routers/repo/single.go +++ b/routers/repo/single.go @@@ -178,34 -188,10 +189,33 @@@ func Single(ctx *middleware.Context, pa ctx.Data["Paths"] = Paths ctx.Data["Treenames"] = treenames - ctx.Data["IsRepoToolbarSource"] = true ctx.Data["BranchLink"] = branchLink - ctx.HTML(200, "repo/single", ctx.Data) + ctx.HTML(200, "repo/single") } +func Http(ctx *middleware.Context, params martini.Params) { + /*if !ctx.Repo.IsValid { + return + }*/ + + // TODO: access check + + username := params["username"] + reponame := params["reponame"] + if strings.HasSuffix(reponame, ".git") { + reponame = reponame[:len(reponame)-4] + } + + prefix := path.Join("/", username, params["reponame"]) + server := &webdav.Server{ + Fs: webdav.Dir(models.RepoPath(username, reponame)), + TrimPrefix: prefix, + Listings: true, + } + + server.ServeHTTP(ctx.ResponseWriter, ctx.Req) +} + func Setting(ctx *middleware.Context, params martini.Params) { if !ctx.Repo.IsOwner { ctx.Error(404)