mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
allow proxying of template images though filestore
This commit is contained in:
parent
eb89337ada
commit
b3432f016c
3 changed files with 4 additions and 3 deletions
|
@ -74,6 +74,7 @@ app.put "/project/:project_id/file/:file_id", keyBuilder.userFileKey, fileContro
|
|||
app.del "/project/:project_id/file/:file_id", keyBuilder.userFileKey, fileController.deleteFile
|
||||
|
||||
app.get "/template/:template_id/v/:version/:format", keyBuilder.templateFileKey, fileController.getFile
|
||||
app.get "/template/:template_id/v/:version/:format/:sub_type", keyBuilder.templateFileKey, fileController.getFile
|
||||
app.post "/template/:template_id/v/:version/:format", keyBuilder.templateFileKey, fileController.insertFile
|
||||
|
||||
app.get "/heapdump", (req, res)->
|
||||
|
|
|
@ -40,7 +40,7 @@ module.exports =
|
|||
args = "nice convert -flatten -background white -density 300 -define pdf:fit-page=#{width} #{sourcePath} -resize #{width} #{destPath}"
|
||||
exec args, childProcessOpts, (err, stdout, stderr)->
|
||||
if err?
|
||||
logger.err err:err, stderr:stderr, sourcePath:sourcePath, "something went wrong converting file to preview"
|
||||
logger.err err:err, stderr:stderr, sourcePath:sourcePath, "something went wrong converting file to thumbnail"
|
||||
else
|
||||
logger.log sourcePath:sourcePath, destPath:destPath, "finished thumbnailing file"
|
||||
callback(err, destPath)
|
||||
|
|
|
@ -24,8 +24,8 @@ module.exports =
|
|||
next()
|
||||
|
||||
templateFileKey: (req, res, next)->
|
||||
{template_id, format, version} = req.params
|
||||
req.key = "#{template_id}/v/#{version}/#{format}"
|
||||
{template_id, format, version, sub_type} = req.params
|
||||
req.key = "#{template_id}/v/#{version}/#{format}/#{sub_type}"
|
||||
req.bucket = settings.filestore.stores.template_files
|
||||
req.version = version
|
||||
opts = req.query
|
||||
|
|
Loading…
Reference in a new issue