Merge pull request #671 from ErisDS/upload-file-fix

Fix for file upload paths on Windows
This commit is contained in:
Hannah Wolfe 2013-09-09 10:06:45 -07:00
commit 03fbffc789

View File

@ -62,7 +62,8 @@ adminControllers = {
dir = path.join('content/images', year, month),
target_path = path.join(dir, req.files.uploadimage.name),
ext = path.extname(req.files.uploadimage.name).toLowerCase(),
src = path.join('/', target_path);
// the src for the image must be in URI format, not a file system path, which in Windows uses \
src = path.join('/', target_path).replace(new RegExp('\\' + path.sep, 'g'), '/');
function renameFile() {
// adds directories recursively