Merge pull request #1384 from halfdan/1377-fs-extra

Fix image upload issue.
This commit is contained in:
Hannah Wolfe 2013-11-03 06:00:43 -08:00
commit 6626c3e7eb
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",