Merge pull request #22481 from overleaf/bg-fix-blob-redirect-middleware

fix fileToBlobRedirectMiddleware internal redirect

GitOrigin-RevId: 874196d58f8b657d73a8e7f1ea4fef8290d48a10
This commit is contained in:
Brian Gough
2024-12-12 11:11:14 +00:00
committed by Copybot
parent 9b490073fc
commit cf8557b7f1
@@ -85,14 +85,16 @@ module.exports = HistoryController = {
if (err) {
return next(err)
}
if (file?.hash) {
req.url = `/project/${projectId}/blob/${file.hash}`
}
metrics.inc('fileToBlobRedirectMiddleware', 1, {
method: req.method,
status: Boolean(file?.hash),
})
next()
if (file?.hash) {
req.url = `/project/${projectId}/blob/${file.hash}`
next('route') // redirect to blob route
} else {
next() // continue with file route
}
}
)
},