未验证 提交 17b84708 编写于 作者: RYAN0UP's avatar RYAN0UP 提交者: GitHub

fix: unable to access custom sheet. (#1246)

上级 be5c6008
...@@ -93,10 +93,6 @@ public class ContentContentController { ...@@ -93,10 +93,6 @@ public class ContentContentController {
public String content(@PathVariable("prefix") String prefix, public String content(@PathVariable("prefix") String prefix,
@RequestParam(value = "token", required = false) String token, @RequestParam(value = "token", required = false) String token,
Model model) { Model model) {
if (optionService.getSheetPermalinkType().equals(SheetPermalinkType.ROOT)) {
Sheet sheet = sheetService.getBySlug(prefix);
return sheetModel.content(sheet, token, model);
}
if (optionService.getArchivesPrefix().equals(prefix)) { if (optionService.getArchivesPrefix().equals(prefix)) {
return postModel.archives(1, model); return postModel.archives(1, model);
} }
...@@ -115,7 +111,11 @@ public class ContentContentController { ...@@ -115,7 +111,11 @@ public class ContentContentController {
if (optionService.getLinksPrefix().equals(prefix)) { if (optionService.getLinksPrefix().equals(prefix)) {
return linkModel.list(model); return linkModel.list(model);
} }
return null; if (optionService.getSheetPermalinkType().equals(SheetPermalinkType.ROOT)) {
Sheet sheet = sheetService.getBySlug(prefix);
return sheetModel.content(sheet, token, model);
}
throw new NotFoundException("Not Found");
} }
@GetMapping("{prefix}/page/{page:\\d+}") @GetMapping("{prefix}/page/{page:\\d+}")
...@@ -155,12 +155,6 @@ public class ContentContentController { ...@@ -155,12 +155,6 @@ public class ContentContentController {
} }
} }
if (optionService.getSheetPermalinkType().equals(SheetPermalinkType.SECONDARY)
&& optionService.getSheetPrefix().equals(prefix)) {
Sheet sheet = sheetService.getBySlug(slug);
return sheetModel.content(sheet, token, model);
}
if (optionService.getCategoriesPrefix().equals(prefix)) { if (optionService.getCategoriesPrefix().equals(prefix)) {
return categoryModel.listPost(model, slug, 1); return categoryModel.listPost(model, slug, 1);
} }
...@@ -175,6 +169,12 @@ public class ContentContentController { ...@@ -175,6 +169,12 @@ public class ContentContentController {
return postModel.content(post, token, model); return postModel.content(post, token, model);
} }
if (optionService.getSheetPermalinkType().equals(SheetPermalinkType.SECONDARY)
&& optionService.getSheetPrefix().equals(prefix)) {
Sheet sheet = sheetService.getBySlug(slug);
return sheetModel.content(sheet, token, model);
}
throw new NotFoundException("Not Found"); throw new NotFoundException("Not Found");
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册