From 3c6135119a841d5ea615481fb175e0846b7c3af9 Mon Sep 17 00:00:00 2001 From: agolybev Date: Thu, 3 Sep 2015 19:17:22 +0300 Subject: [PATCH] add support aws-sdk/putObject parameter 'ContentDisposition' --- lib/controllers.js | 2 ++ lib/file-store.js | 4 ++++ lib/models/s3-object.js | 1 + 3 files changed, 7 insertions(+) diff --git a/lib/controllers.js b/lib/controllers.js index f4dd041f..15575603 100644 --- a/lib/controllers.js +++ b/lib/controllers.js @@ -18,6 +18,8 @@ module.exports = function (rootDirectory, logger, indexDocument, errorDocument) res.header('Last-Modified', new Date(object.modifiedDate).toUTCString()); res.header('Content-Type', object.contentType); + if (object.contentDisposition) + res.header('Content-Disposition', object.contentDisposition); if (object.contentEncoding) res.header('Content-Encoding', object.contentEncoding); diff --git a/lib/file-store.js b/lib/file-store.js index 343fa8a4..f6f6137b 100644 --- a/lib/file-store.js +++ b/lib/file-store.js @@ -148,6 +148,7 @@ var FileStore = function (rootDirectory) { key: key, md5: json.md5, contentType: json.contentType, + contentDisposition: json.contentDisposition, contentEncoding: json.contentEncoding, size: json.size, modifiedDate: json.modifiedDate, @@ -173,6 +174,7 @@ var FileStore = function (rootDirectory) { var createMetaData = function (data, done) { var contentFile = data.contentFile, type = data.type, + disposition = data.disposition, encoding = data.encoding, metaFile = data.metaFile, headers = data.headers; @@ -200,6 +202,7 @@ var FileStore = function (rootDirectory) { var metaData = { md5: results[1].md5, contentType: type, + contentDisposition: disposition, size: results[1].size, modifiedDate: results[0].mtime, creationDate: results[0].ctime, @@ -232,6 +235,7 @@ var FileStore = function (rootDirectory) { createMetaData({ contentFile: contentFile, type: req.headers['content-type'], + disposition: req.headers['content-disposition'], encoding: req.headers['content-encoding'], key: key, metaFile: metaFile, diff --git a/lib/models/s3-object.js b/lib/models/s3-object.js index 2ea44e3d..28652951 100644 --- a/lib/models/s3-object.js +++ b/lib/models/s3-object.js @@ -3,6 +3,7 @@ var S3Object = function (s3Item) { var item = { key: s3Item.key, contentType: s3Item.contentType, + contentDisposition: s3Item.contentDisposition, contentEncoding: s3Item.contentEncoding, md5: s3Item.md5, size: s3Item.size,