mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-11-03 20:45:58 +01:00 
			
		
		
		
	Fix postcount is expected to be Number (#5567)
This commit is contained in:
		
				
					committed by
					
						
						psychobunny
					
				
			
			
				
	
			
			
			
						parent
						
							53dac97800
						
					
				
				
					commit
					03d432182b
				
			@@ -67,6 +67,7 @@ topicsController.get = function (req, res, callback) {
 | 
				
			|||||||
			settings = results.settings;
 | 
								settings = results.settings;
 | 
				
			||||||
			var postCount = parseInt(results.topic.postcount, 10);
 | 
								var postCount = parseInt(results.topic.postcount, 10);
 | 
				
			||||||
			pageCount = Math.max(1, Math.ceil(postCount / settings.postsPerPage));
 | 
								pageCount = Math.max(1, Math.ceil(postCount / settings.postsPerPage));
 | 
				
			||||||
 | 
								results.topic.postcount = postCount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (utils.isNumber(req.params.post_index) && (req.params.post_index < 1 || req.params.post_index > postCount)) {
 | 
								if (utils.isNumber(req.params.post_index) && (req.params.post_index < 1 || req.params.post_index > postCount)) {
 | 
				
			||||||
				return helpers.redirect(res, '/topic/' + req.params.topic_id + '/' + req.params.slug + (req.params.post_index > postCount ? '/' + postCount : ''));
 | 
									return helpers.redirect(res, '/topic/' + req.params.topic_id + '/' + req.params.slug + (req.params.post_index > postCount ? '/' + postCount : ''));
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user