mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
parent
2983e657a6
commit
ec79069a1c
1 changed files with 10 additions and 19 deletions
|
@ -58,24 +58,15 @@ localfilesystem = {
|
||||||
|
|
||||||
getUniqueFileName(target_dir, basename, ext, null, function (filename) {
|
getUniqueFileName(target_dir, basename, ext, null, function (filename) {
|
||||||
|
|
||||||
fs.mkdirs(target_dir, function (err) {
|
nodefn.call(fs.mkdirs, target_dir).then(function () {
|
||||||
if (err) {
|
return nodefn.call(fs.copy, image.path, target_path);
|
||||||
errors.logError(err);
|
}).then(function () {
|
||||||
return saved.reject();
|
// The src for the image must be in URI format, not a file system path, which in Windows uses \
|
||||||
}
|
var fullUrl = path.join(ghostUrl, filename).replace(new RegExp('\\' + path.sep, 'g'), '/');
|
||||||
|
return saved.resolve(fullUrl);
|
||||||
fs.copy(image.path, target_path, function (err) {
|
}).otherwise(function (e) {
|
||||||
if (err) {
|
errors.logError(e);
|
||||||
errors.logError(err);
|
return saved.reject(e);
|
||||||
return saved.reject();
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE as every upload will need to delete the tmp file make this the admin controllers job
|
|
||||||
|
|
||||||
// The src for the image must be in URI format, not a file system path, which in Windows uses \
|
|
||||||
var fullUrl = path.join(ghostUrl, filename).replace(new RegExp('\\' + path.sep, 'g'), '/');
|
|
||||||
return saved.resolve(fullUrl);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -83,4 +74,4 @@ localfilesystem = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = localfilesystem;
|
module.exports = localfilesystem;
|
||||||
|
|
Loading…
Add table
Reference in a new issue