Add FileUtil#getContentType().

This commit is contained in:
takezoe
2013-10-04 04:17:30 +09:00
parent f4f2bf34fc
commit 380cdbcf75
3 changed files with 14 additions and 16 deletions

View File

@@ -164,12 +164,7 @@ trait WikiControllerBase extends ControllerBase with FlashMapSupport {
val path = multiParams("splat").head
getFileContent(repository.owner, repository.name, path).map { bytes =>
val mimeType = FileUtil.getMimeType(path)
contentType = if(mimeType == "application/octet-stream" && FileUtil.isText(bytes)){
"text/plain"
} else {
mimeType
}
contentType = FileUtil.getContentType(path, bytes)
bytes
} getOrElse NotFound
})