Expose `originalFilename` property

Filename is replaced when `getFilename` is set in the options, this commit sets a new property called `originalFilename` to keep the original filename (only works when you upload the file, after that you need to save it in a model).
This commit is contained in:
Santiago Osorio 2015-12-05 14:52:01 -06:00
parent eafe773c77
commit 8eaf9f54a0
2 changed files with 2 additions and 1 deletions

View File

@ -68,6 +68,7 @@ exports.upload = function(provider, req, res, options, cb) {
// Build a filename
if ('function' === typeof options.getFilename) {
file.originalFilename = file.name;
file.name = options.getFilename(file, req, res);
}

View File

@ -179,7 +179,7 @@ describe('storage service', function () {
.expect('Content-Type', /json/)
.expect(200, function (err, res) {
assert.deepEqual(res.body, {"result": {"files": {"image": [
{"container": "album1", "name": "image-test.jpg", "type": "image/jpeg", "acl":"public-read", "size": 60475}
{"container": "album1", "name": "image-test.jpg", "originalFilename":"test.jpg", "type": "image/jpeg", "acl":"public-read", "size": 60475}
]}, "fields": {}}});
done();
});