mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-30 18:46:01 +01:00 
			
		
		
		
	fix: regression caused by 77ab46686d
				
					
				
			Access checks were added for topic GET route, but occasionally a post_uuid is passed in, which is available to everyone, and so checks should be skipped
This commit is contained in:
		| @@ -104,9 +104,15 @@ Topics.deleteTags = async (req, res) => { | |||||||
| }; | }; | ||||||
|  |  | ||||||
| Topics.getThumbs = async (req, res) => { | Topics.getThumbs = async (req, res) => { | ||||||
| 	if (!await privileges.topics.can('topics:read', req.params.tid, req.uid)) { | 	if (isFinite(req.params.tid)) {	// post_uuids can be passed in occasionally, in that case no checks are necessary | ||||||
|  | 		const [exists, canRead] = await Promise.all([ | ||||||
|  | 			topics.exists(req.params.tid), | ||||||
|  | 			privileges.topics.can('topics:read', req.params.tid, req.uid), | ||||||
|  | 		]); | ||||||
|  | 		if (!exists || !canRead) { | ||||||
| 			return helpers.formatApiResponse(403, res); | 			return helpers.formatApiResponse(403, res); | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	helpers.formatApiResponse(200, res, await topics.thumbs.get(req.params.tid)); | 	helpers.formatApiResponse(200, res, await topics.thumbs.get(req.params.tid)); | ||||||
| }; | }; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user