2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

Fix for file upload paths on Windows

closes #669

- override incorrect path separators with / in the src for an image.
This commit is contained in:
Hannah Wolfe 2013-09-09 17:19:58 +01:00
parent bbbfed9921
commit 0b3f2797e9

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