Skip to content

Node.js based forum software built for the modern web

upload_url shouldn't use path.join

psychobunny6f1a795f0e28
diff --git a/app.js b/app.js
index c7f3d637a6..9661002f91 100644
--- a/app.js
+++ b/app.js
@@ -90,7 +90,7 @@ function loadConfig() {
nconf.defaults({
base_dir: __dirname,
themes_path: path.join(__dirname, 'node_modules'),
- upload_url: path.join(path.sep, 'uploads', path.sep),
+ upload_url: '/uploads/',
views_dir: path.join(__dirname, 'public/templates')
});
diff --git a/src/file.js b/src/file.js
index 4d0068dabf..f88728b860 100644
--- a/src/file.js
+++ b/src/file.js
@@ -8,6 +8,7 @@ var fs = require('fs'),
var file = {};
file.saveFileToLocal = function(filename, tempPath, callback) {
+
var uploadPath = path.join(nconf.get('base_dir'), nconf.get('upload_path'), filename);
winston.info('Saving file '+ filename +' to : ' + uploadPath);
@@ -17,7 +18,7 @@ file.saveFileToLocal = function(filename, tempPath, callback) {
is.on('end', function () {
callback(null, {
- url: (nconf.get('upload_url') + filename).split(path.sep).join('/')
+ url: nconf.get('upload_url') + filename
});
});
@@ -29,6 +30,4 @@ file.saveFileToLocal = function(filename, tempPath, callback) {
is.pipe(os);
};
-module.exports = file;
-
-
+module.exports = file;
\ No newline at end of file