From a494027217021c796f51ea6df322728829cd37b9 Mon Sep 17 00:00:00 2001 From: Keiichi Watanabe Date: Mon, 22 Aug 2016 18:58:59 +0900 Subject: [PATCH] Set default value to `ref` param in contents-API --- src/main/scala/gitbucket/core/controller/ApiController.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/gitbucket/core/controller/ApiController.scala b/src/main/scala/gitbucket/core/controller/ApiController.scala index 4a9b218ce..dd249c4ab 100644 --- a/src/main/scala/gitbucket/core/controller/ApiController.scala +++ b/src/main/scala/gitbucket/core/controller/ApiController.scala @@ -110,7 +110,7 @@ trait ApiControllerBase extends ControllerBase { */ get("/api/v3/repos/:owner/:repo/contents/*")(referrersOnly { repository => val (id, path) = repository.splitPath(multiParams("splat").head) - val refStr = params("ref") + val refStr = params.getOrElse("ref", repository.repository.defaultBranch) using(Git.open(getRepositoryDir(params("owner"), params("repo")))){ git => if (path.isEmpty) { JsonFormat(getFileList(git, refStr, ".").map{f => ApiContents(f)})