From b3432f016cdeb7fe0a1010385d8bd799e1610913 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 9 Apr 2015 17:14:47 +0100 Subject: [PATCH] allow proxying of template images though filestore --- services/filestore/app.coffee | 1 + services/filestore/app/coffee/FileConverter.coffee | 2 +- services/filestore/app/coffee/KeyBuilder.coffee | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/services/filestore/app.coffee b/services/filestore/app.coffee index 293f5da8e8..f42cf4f1b4 100644 --- a/services/filestore/app.coffee +++ b/services/filestore/app.coffee @@ -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)-> diff --git a/services/filestore/app/coffee/FileConverter.coffee b/services/filestore/app/coffee/FileConverter.coffee index 0d6eb0d9f3..da10711f99 100644 --- a/services/filestore/app/coffee/FileConverter.coffee +++ b/services/filestore/app/coffee/FileConverter.coffee @@ -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) diff --git a/services/filestore/app/coffee/KeyBuilder.coffee b/services/filestore/app/coffee/KeyBuilder.coffee index 71f6c05785..03a65a8337 100644 --- a/services/filestore/app/coffee/KeyBuilder.coffee +++ b/services/filestore/app/coffee/KeyBuilder.coffee @@ -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