fix import APRedirect loop

This commit is contained in:
lesion
2022-02-21 10:46:39 +01:00
parent 878c77f573
commit f1ad1f1f65

View File

@@ -225,17 +225,13 @@ module.exports = {
},
async APRedirect (req, res, next) {
const accepted = req.accepts('html', 'application/json', 'application/activity+json', 'application/ld+json' )
if (accepted && accepted !== 'html') {
if (!req.accepts('html')) {
const eventController = require('../server/api/controller/event')
try {
const event = await eventController._get(req.params.slug)
if (event) {
return res.redirect(`/federation/m/${event.id}`)
}
} catch (e) {}
const event = await eventController._get(req.params.slug)
if (event) {
return res.redirect(`/federation/m/${event.id}`)
}
}
next()
}
}