.
This commit is contained in:
parent
afd69b9da4
commit
5974576d28
@ -17,12 +17,12 @@ const CDN_PATHS = {
|
||||
|
||||
const sanitizeFilename = (filename) => safename(sanitize(filename, { replacement: "_" }));
|
||||
|
||||
const getUniqueName = function (path, filename) {
|
||||
const getUniqueName = function (_path, _filename) {
|
||||
const namer = unf({
|
||||
format: '%32b_%6r%8e',
|
||||
dir: path
|
||||
format: '%48b_%2i%4e',
|
||||
dir: _path
|
||||
});
|
||||
return namer(filename)
|
||||
return namer(_filename)
|
||||
}
|
||||
|
||||
const getCDNMediaUrl = (mediaUri) => {
|
||||
@ -53,7 +53,7 @@ const getCDNPath = (type = '') => {
|
||||
|
||||
default:
|
||||
var _date = new Date();
|
||||
cdnPath = _date.getFullYear() + '/' + _date.getMonth() + '/';
|
||||
cdnPath = _date.getFullYear() + '/' + (_date.getMonth() + 1) + '/';
|
||||
break;
|
||||
}
|
||||
return Path.join(config.uploads.path, cdnPath);
|
||||
|
||||
@ -24,8 +24,8 @@ var cdnStorage = function(path) {
|
||||
},
|
||||
filename: function (req, file, cb) {
|
||||
cdnHelper.getUniqueName(path, file.originalname)
|
||||
.then(function(betterName) {
|
||||
cb(null, betterName)
|
||||
.then(function(betterName) {
|
||||
cb(null, betterName.replace(path, ''));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user