From 0b3f2797e9191dc4652e21f28701c0bb915aa42c Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Mon, 9 Sep 2013 17:19:58 +0100 Subject: [PATCH] Fix for file upload paths on Windows closes #669 - override incorrect path separators with / in the src for an image. --- core/server/controllers/admin.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/server/controllers/admin.js b/core/server/controllers/admin.js index 8c3f5d1bfe..493863de1f 100644 --- a/core/server/controllers/admin.js +++ b/core/server/controllers/admin.js @@ -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