From 35fc175ff69bf7d8dac714c502593b02915f73fa Mon Sep 17 00:00:00 2001 From: Spiritlebon Date: Sun, 12 Oct 2014 03:36:38 +0200 Subject: [PATCH 1/2] Lint fix --- public/src/client/topic.js | 2 +- src/socket.io/topics.js | 2 +- src/upgrade.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/src/client/topic.js b/public/src/client/topic.js index dcb85f203a..597f259f86 100644 --- a/public/src/client/topic.js +++ b/public/src/client/topic.js @@ -239,7 +239,7 @@ define('forum/topic', dependencies, function(pagination, infinitescroll, threadT slug = parts[2]; var newUrl = 'topic/' + topicId + '/' + (slug ? slug : ''); if (postIndex > 0) { - newUrl += '/' + (postIndex + 1); + newUrl += '/' + (postIndex + 1); } if (newUrl !== currentUrl) { diff --git a/src/socket.io/topics.js b/src/socket.io/topics.js index ffeab1d719..d8e6660d73 100644 --- a/src/socket.io/topics.js +++ b/src/socket.io/topics.js @@ -404,7 +404,7 @@ SocketTopics.follow = function(socket, tid, callback) { }; SocketTopics.loadMore = function(socket, data, callback) { - if(!data || !data.tid || !(parseInt(data.after, 10) >= 0)) { + if(!data || !data.tid || (parseInt(data.after, 10) < 0)) { return callback(new Error('[[error:invalid-data]]')); } diff --git a/src/upgrade.js b/src/upgrade.js index b83adc4d01..32781d8ec9 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -1,4 +1,4 @@ -"use strict"; +"use strict"; var db = require('./database'), async = require('async'), From 2b15de63c0a44212f877897f9a7f360e504132ad Mon Sep 17 00:00:00 2001 From: Spiritlebon Date: Sun, 12 Oct 2014 04:01:35 +0200 Subject: [PATCH 2/2] checked number before parseInt --- src/socket.io/topics.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/socket.io/topics.js b/src/socket.io/topics.js index d8e6660d73..d80f12956e 100644 --- a/src/socket.io/topics.js +++ b/src/socket.io/topics.js @@ -404,7 +404,7 @@ SocketTopics.follow = function(socket, tid, callback) { }; SocketTopics.loadMore = function(socket, data, callback) { - if(!data || !data.tid || (parseInt(data.after, 10) < 0)) { + if(!data || !data.tid || !utils.isNumber(data.after) || parseInt(data.after, 10) < 0) { return callback(new Error('[[error:invalid-data]]')); }