mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
support the direct path to a clsi output file /project/project_id/build/build_id/output/*
this avoids use of the query string ?build=... and so we can match the url directly with the nginx location directive
This commit is contained in:
parent
ab0bcd4f57
commit
ee15bbeee0
2 changed files with 17 additions and 1 deletions
|
@ -93,7 +93,12 @@ module.exports = CompileController =
|
|||
|
||||
getFileFromClsi: (req, res, next = (error) ->) ->
|
||||
project_id = req.params.Project_id
|
||||
CompileController.proxyToClsi(project_id, "/project/#{project_id}/output/#{req.params.file}", req, res, next)
|
||||
build = req.params.build
|
||||
if build?
|
||||
url = "/project/#{project_id}/build/#{build}/output/#{req.params.file}"
|
||||
else
|
||||
url = "/project/#{project_id}/output/#{req.params.file}"
|
||||
CompileController.proxyToClsi(project_id, url, req, res, next)
|
||||
|
||||
proxySync: (req, res, next = (error) ->) ->
|
||||
CompileController.proxyToClsi(req.params.Project_id, req.url, req, res, next)
|
||||
|
|
|
@ -113,6 +113,17 @@ module.exports = class Router
|
|||
req.params = params
|
||||
next()
|
||||
), AuthorizationMiddlewear.ensureUserCanReadProject, CompileController.getFileFromClsi
|
||||
# direct url access to output files for a specific build (query string not required)
|
||||
webRouter.get /^\/project\/([^\/]*)\/build\/([0-9a-f-]+)\/output\/(.*)$/,
|
||||
((req, res, next) ->
|
||||
params =
|
||||
"Project_id": req.params[0]
|
||||
"build": req.params[1]
|
||||
"file": req.params[2]
|
||||
req.params = params
|
||||
next()
|
||||
), AuthorizationMiddlewear.ensureUserCanReadProject, CompileController.getFileFromClsi
|
||||
|
||||
webRouter.delete "/project/:Project_id/output", AuthorizationMiddlewear.ensureUserCanReadProject, CompileController.deleteAuxFiles
|
||||
webRouter.get "/project/:Project_id/sync/code", AuthorizationMiddlewear.ensureUserCanReadProject, CompileController.proxySync
|
||||
webRouter.get "/project/:Project_id/sync/pdf", AuthorizationMiddlewear.ensureUserCanReadProject, CompileController.proxySync
|
||||
|
|
Loading…
Reference in a new issue