diff --git a/src/main/scala/gitbucket/core/controller/ApiController.scala b/src/main/scala/gitbucket/core/controller/ApiController.scala
index 344969e..d118fa4 100644
--- a/src/main/scala/gitbucket/core/controller/ApiController.scala
+++ b/src/main/scala/gitbucket/core/controller/ApiController.scala
@@ -133,9 +133,12 @@
val largeFile = params.get("large_file").exists(s => s.equals("true"))
val content = getContentFromId(git, f.id, largeFile)
request.getHeader("Accept") match {
- case "application/vnd.github.v3.raw" =>
+ case "application/vnd.github.v3.raw" => {
+ contentType = "application/vnd.github.v3.raw"
content
- case "application/vnd.github.v3.html" if isRenderable(f.name) =>
+ }
+ case "application/vnd.github.v3.html" if isRenderable(f.name) => {
+ contentType = "application/vnd.github.v3.html"
content.map(c =>
List(
"
", "
",
@@ -143,7 +146,9 @@
"", "
"
).mkString
)
- case "application/vnd.github.v3.html" =>
+ }
+ case "application/vnd.github.v3.html" => {
+ contentType = "application/vnd.github.v3.html"
content.map(c =>
List(
"", "
", "
",
@@ -151,6 +156,7 @@
"
", "
", "
"
).mkString
)
+ }
case _ =>
Some(JsonFormat(ApiContents(f, content)))
}
@@ -278,6 +284,19 @@
}
/**
+ * https://developer.github.com/v3/issues/#get-a-single-issue
+ */
+ get("/api/v3/repos/:owner/:repository/issues/:id")(referrersOnly { repository =>
+ (for{
+ issueId <- params("id").toIntOpt
+ issue <- getIssue(repository.owner, repository.name, issueId.toString)
+ openedUser <- getAccountByUserName(issue.openedUserName)
+ } yield {
+ JsonFormat(ApiIssue(issue, RepositoryName(repository), ApiUser(openedUser)))
+ }) getOrElse NotFound()
+ })
+
+ /**
* https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue
*/
get("/api/v3/repos/:owner/:repository/issues/:id/comments")(referrersOnly { repository =>