Fix looking up AP objects being broken by permalink format change

This commit is contained in:
Shadowfacts 2020-06-05 11:16:03 -04:00
parent b2ade96864
commit 5fae1c15ea
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 2 additions and 2 deletions

View File

@ -56,12 +56,12 @@ export async function toFederate(): Promise<[string, ArticleObject][]> {
}
export function route(router: Router) {
router.use("/:category/:year/:slug/", async (req, res, next) => {
router.use("/:year/:slug/", async (req, res, next) => {
const best = req.accepts(["text/html", "application/activity+json"]);
if (best === "text/html") {
next();
} else if (best === "application/activity+json") {
const id = `/${req.params.category}/${req.params.year}/${req.params.slug}/`;
const id = `/${req.params.year}/${req.params.slug}/`;
const repository = getConnection().getRepository(Article);
try {
const article = await repository.findOne(id);