[Notice] Announcing the End of Demo Server [Read me]
code: Fix error that may occur when 'master branch' does not exist
@0dd93624d7ef7233cd67d2d5ce677d7f13b938b5
--- app/controllers/CodeApp.java
+++ app/controllers/CodeApp.java
... | ... | @@ -28,6 +28,7 @@ |
28 | 28 |
import utils.ErrorViews; |
29 | 29 |
import utils.FileUtil; |
30 | 30 |
import utils.HttpUtil; |
31 |
+import utils.MenuType; |
|
31 | 32 |
import views.html.code.nohead; |
32 | 33 |
import views.html.code.nohead_svn; |
33 | 34 |
import views.html.code.view; |
... | ... | @@ -103,7 +104,7 @@ |
103 | 104 |
Cache.set(cacheKey, recursiveData); |
104 | 105 |
} |
105 | 106 |
if (recursiveData == null) { |
106 |
- return notFound(ErrorViews.NotFound.render()); |
|
107 |
+ return notFound(ErrorViews.NotFound.render(branch, project, "code")); |
|
107 | 108 |
} |
108 | 109 |
|
109 | 110 |
return ok(view.render(project, branches, recursiveData, branch, path)); |
--- app/models/Project.java
+++ app/models/Project.java
... | ... | @@ -256,6 +256,9 @@ |
256 | 256 |
if (!branches.isEmpty() && repository instanceof GitRepository) { |
257 | 257 |
GitRepository gitRepo = new GitRepository(owner, name); |
258 | 258 |
List<Commit> history = gitRepo.getHistory(0, 2, "HEAD", null); |
259 |
+ if(history == null) { |
|
260 |
+ return this.createdDate; |
|
261 |
+ } |
|
259 | 262 |
return history.get(0).getAuthorDate(); |
260 | 263 |
} |
261 | 264 |
} catch (IOException e) { |
--- app/views/error/notfound.scala.html
+++ app/views/error/notfound.scala.html
... | ... | @@ -25,6 +25,7 @@ |
25 | 25 |
case "issue_post" => utils.MenuType.ISSUE |
26 | 26 |
case "board_post" => utils.MenuType.BOARD |
27 | 27 |
case "milestone" => utils.MenuType.MILESTONE |
28 |
+ case "code" => utils.MenuType.CODE |
|
28 | 29 |
case _ => utils.MenuType.PROJECT_HOME |
29 | 30 |
} |
30 | 31 |
} |
... | ... | @@ -34,13 +35,14 @@ |
34 | 35 |
case "issue_post" => routes.IssueApp.issues(project.owner, project.name, "all") |
35 | 36 |
case "board_post" => routes.BoardApp.posts(project.owner, project.name) |
36 | 37 |
case "milestone" => routes.MilestoneApp.milestones(project.owner, project.name) |
38 |
+ case "code" => routes.ProjectApp.settingForm(project.owner, project.name) |
|
37 | 39 |
case _ => "javascript:history.back();" |
38 | 40 |
} |
39 | 41 |
} |
40 | 42 |
|
41 | 43 |
@getMessage(target:String) = @{ |
42 | 44 |
if(target){ |
43 |
- Messages("error.notfound." + target) |
|
45 |
+ Messages("error.notfound." + target, title) |
|
44 | 46 |
} else { |
45 | 47 |
Messages("error.notfound") |
46 | 48 |
} |
--- conf/messages
+++ conf/messages
... | ... | @@ -211,7 +211,9 @@ |
211 | 211 |
error.internalServerError = Server error has occurred; service is not available |
212 | 212 |
error.notfound = Page not found |
213 | 213 |
error.notfound.board_post = Post not exists |
214 |
+error.notfound.branch = Branch doesn't exists |
|
214 | 215 |
error.notfound.code_comment = Commit-comment not exists |
216 |
+error.notfound.code = {0} branch doesn't exists. Check project default branch! |
|
215 | 217 |
error.notfound.commit = Commit not exists |
216 | 218 |
error.notfound.issue_post = Issue not exists |
217 | 219 |
error.notfound.milestone = Milestone not exists |
--- conf/messages.ko-KR
+++ conf/messages.ko-KR
... | ... | @@ -213,7 +213,9 @@ |
213 | 213 |
error.internalServerError = 서버 오류가 발생하여 서비스를 이용할 수 없습니다 |
214 | 214 |
error.notfound = 페이지를 찾을 수 없습니다 |
215 | 215 |
error.notfound.board_post = 존재하지 않는 글입니다 |
216 |
+error.notfound.branch = 브랜치가 존재하지 않습니다 |
|
216 | 217 |
error.notfound.code_comment = 존재하지 않는 커밋 댓글입니다. |
218 |
+error.notfound.code = {0} 브랜치가 없습니다. 기본 브랜치 설정을 확인해 주세요. |
|
217 | 219 |
error.notfound.commit = 존재하지 않는 커밋입니다. |
218 | 220 |
error.notfound.issue_post = 존재하지 않는 이슈입니다 |
219 | 221 |
error.notfound.milestone = 존재하지 않는 마일스톤입니다. |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?