Post post = postRepository.findByPublicSlugAndDraftFalseAndPublishAtBefore(publicSlug, now);
if (post == null) {
post = postRepository.findByPublicSlugAliasesInAndDraftFalseAndPublishAtBefore(
Collections.singleton(publicSlug), now);
if (post != null) {
throw new PostMovedException(post.getPublicSlug());
}
throw new PostNotFoundException(publicSlug);
}
return post;
}