Skip to content

Node.js based forum software built for the modern web

fixes #1396

psychobunny51a7d163be4e
diff --git a/src/file.js b/src/file.js
index 46044c3c6b..4d0068dabf 100644
--- a/src/file.js
+++ b/src/file.js
@@ -1,3 +1,5 @@
+"use strict";
+
var fs = require('fs'),
nconf = require('nconf'),
path = require('path'),
@@ -6,7 +8,6 @@ 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);
@@ -16,7 +17,7 @@ file.saveFileToLocal = function(filename, tempPath, callback) {
is.on('end', function () {
callback(null, {
- url: nconf.get('upload_url') + filename
+ url: (nconf.get('upload_url') + filename).split(path.sep).join('/')
});
});
@@ -26,7 +27,7 @@ file.saveFileToLocal = function(filename, tempPath, callback) {
});
is.pipe(os);
-}
+};
module.exports = file;