Skip to content

Commit

Permalink
fix: unable to access custom sheet. (halo-dev#1246)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby authored Jan 27, 2021
1 parent 96ef1c0 commit e6bb96b
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ public ContentContentController(PostModel postModel,
public String content(@PathVariable("prefix") String prefix,
@RequestParam(value = "token", required = false) String token,
Model model) {
if (optionService.getSheetPermalinkType().equals(SheetPermalinkType.ROOT)) {
Sheet sheet = sheetService.getBySlug(prefix);
return sheetModel.content(sheet, token, model);
}
if (optionService.getArchivesPrefix().equals(prefix)) {
return postModel.archives(1, model);
}
Expand All @@ -115,7 +111,11 @@ public String content(@PathVariable("prefix") String prefix,
if (optionService.getLinksPrefix().equals(prefix)) {
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+}")
Expand Down Expand Up @@ -155,12 +155,6 @@ public String content(@PathVariable("prefix") String prefix,
}
}

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)) {
return categoryModel.listPost(model, slug, 1);
}
Expand All @@ -175,6 +169,12 @@ public String content(@PathVariable("prefix") String prefix,
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");
}

Expand Down

0 comments on commit e6bb96b

Please sign in to comment.