fix import APRedirect loop
This commit is contained in:
@@ -225,17 +225,13 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async APRedirect (req, res, next) {
|
async APRedirect (req, res, next) {
|
||||||
const accepted = req.accepts('html', 'application/json', 'application/activity+json', 'application/ld+json' )
|
if (!req.accepts('html')) {
|
||||||
if (accepted && accepted !== 'html') {
|
|
||||||
const eventController = require('../server/api/controller/event')
|
const eventController = require('../server/api/controller/event')
|
||||||
try {
|
const event = await eventController._get(req.params.slug)
|
||||||
const event = await eventController._get(req.params.slug)
|
if (event) {
|
||||||
if (event) {
|
return res.redirect(`/federation/m/${event.id}`)
|
||||||
return res.redirect(`/federation/m/${event.id}`)
|
}
|
||||||
}
|
|
||||||
} catch (e) {}
|
|
||||||
}
|
}
|
||||||
next()
|
next()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user