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:
parent
eafe773c77
commit
8eaf9f54a0
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue