From b3544f644a45f1e5ebf91c5d3c2cf63173a60fa5 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 13 Nov 2014 13:00:36 -0500 Subject: [PATCH] relative path upload fixes #2403 --- app.js | 2 +- public/src/modules/composer/uploads.js | 4 ++-- src/categories.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 3869c8df9b..e90539c95a 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: '/uploads/', + upload_url: nconf.get('relative_path') + '/uploads/', views_dir: path.join(__dirname, 'public/templates') }); diff --git a/public/src/modules/composer/uploads.js b/public/src/modules/composer/uploads.js index 54822aa681..46b0277bcd 100644 --- a/public/src/modules/composer/uploads.js +++ b/public/src/modules/composer/uploads.js @@ -213,7 +213,7 @@ define('composer/uploads', ['composer/preview'], function(preview) { text = textarea.val(), uploadForm = postContainer.find('#fileForm'); - uploadForm.attr('action', params.route); + uploadForm.attr('action', config.relative_path + params.route); for(var i = 0; i < files.length; ++i) { var isImage = files[i].type.match(/image./); @@ -288,7 +288,7 @@ define('composer/uploads', ['composer/preview'], function(preview) { spinner = postContainer.find('.topic-thumb-spinner'), thumbForm = postContainer.find('#thumbForm'); - thumbForm.attr('action', params.route); + thumbForm.attr('action', config.relative_path + params.route); thumbForm.off('submit').submit(function() { var csrf = $('#csrf').attr('data-csrf'); diff --git a/src/categories.js b/src/categories.js index 6b5705b33f..bf0a94fde9 100644 --- a/src/categories.js +++ b/src/categories.js @@ -174,7 +174,7 @@ var async = require('async'), } if (category.image) { - category.backgroundImage = category.image ? nconf.get('relative_path') + category.image : ''; + category.backgroundImage = category.image; } callback(null, category);