relative path fix missing ;

v1.18.x
barisusakli 10 years ago
parent 1f674f10e2
commit 02dbce57fb

@ -60,7 +60,8 @@ define('navigator', ['forum/pagination'], function(pagination) {
}; };
function generateUrl(index) { function generateUrl(index) {
var parts = window.location.pathname.split('/'); var pathname = window.location.pathname.replace(config.relative_path, '');
var parts = pathname.split('/');
return parts[1] + '/' + parts[2] + '/' + parts[3] + (index ? '/' + index : ''); return parts[1] + '/' + parts[2] + '/' + parts[3] + (index ? '/' + index : '');
} }

@ -83,7 +83,7 @@ middleware.addSlug = function(req, res, next) {
return next(err); return next(err);
} }
var url = name + encodeURI(slug); var url = nconf.get('relative_path') + name + encodeURI(slug);
if (res.locals.isAPI) { if (res.locals.isAPI) {
res.status(302).json(url); res.status(302).json(url);
@ -95,13 +95,10 @@ middleware.addSlug = function(req, res, next) {
if (!req.params.slug) { if (!req.params.slug) {
if (req.params.category_id) { if (req.params.category_id) {
redirect(categories.getCategoryField, req.params.category_id, '/category/'); return redirect(categories.getCategoryField, req.params.category_id, '/category/');
} else if (req.params.topic_id) { } else if (req.params.topic_id) {
redirect(topics.getTopicField, req.params.topic_id, '/topic/'); return redirect(topics.getTopicField, req.params.topic_id, '/topic/');
} else {
return next();
} }
return;
} }
next(); next();
}; };

@ -16,11 +16,11 @@ describe('Hash methods', function() {
assert.equal(arguments.length, 1); assert.equal(arguments.length, 1);
done(); done();
}); });
}) });
describe('setObject()', function() { describe('setObject()', function() {
it('should create a object', function(done) { it('should create a object', function(done) {
db.setObject('testObject2', testData, function(err) { db.setObject('testObject10', testData, function(err) {
assert.equal(err, null); assert.equal(err, null);
assert.equal(arguments.length, 1); assert.equal(arguments.length, 1);
done(); done();

Loading…
Cancel
Save