Fix image upload issue.

fixes #1377
This commit is contained in:
Fabian Becker 2013-11-02 11:12:09 +00:00
parent 9b2434be4c
commit 48d3b10649
2 changed files with 2 additions and 4 deletions

View File

@ -48,14 +48,12 @@ localfilesystem = {
month = m.format('MMM'),
year = m.format('YYYY'),
target_dir = path.join('content/images', year, month),
target_path = path.join(target_dir, image.name),
ext = path.extname(image.name),
basename = path.basename(image.name, ext).replace(/[\W]/gi, '_');
getUniqueFileName(target_dir, basename, ext, null, function (filename) {
nodefn.call(fs.mkdirs, target_dir).then(function () {
return nodefn.call(fs.copy, image.path, target_path);
return nodefn.call(fs.copy, image.path, filename);
}).then(function () {
// The src for the image must be in URI format, not a file system path, which in Windows uses \
// For local file system storage can use relative path so add a slash

View File

@ -36,7 +36,7 @@
"downsize": "0.0.3",
"express": "3.4.4",
"express-hbs": "0.5.1",
"fs-extra": "0.6.3",
"fs-extra": "0.8.1",
"knex": "0.4.13",
"moment": "2.4.0",
"node-polyglot": "0.3.0",