mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	closes #6132
This commit is contained in:
		| @@ -286,7 +286,7 @@ Controllers.outgoing = function (req, res, next) { | |||||||
| 	var allowedProtocols = ['http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal']; | 	var allowedProtocols = ['http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal']; | ||||||
| 	var parsed = require('url').parse(url); | 	var parsed = require('url').parse(url); | ||||||
|  |  | ||||||
| 	if (!url || !allowedProtocols.includes(parsed.protocol.slice(0, -1))) { | 	if (!url || !parsed.protocol || !allowedProtocols.includes(parsed.protocol.slice(0, -1))) { | ||||||
| 		return next(); | 		return next(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -352,6 +352,15 @@ describe('Controllers', function () { | |||||||
| 		}); | 		}); | ||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
|  | 	it('should 404 on /outgoing with invalid url', function (done) { | ||||||
|  | 		request(nconf.get('url') + '/outgoing?url=derp', function (err, res, body) { | ||||||
|  | 			assert.ifError(err); | ||||||
|  | 			assert.equal(res.statusCode, 404); | ||||||
|  | 			assert(body); | ||||||
|  | 			done(); | ||||||
|  | 		}); | ||||||
|  | 	}); | ||||||
|  |  | ||||||
| 	it('should load /tos', function (done) { | 	it('should load /tos', function (done) { | ||||||
| 		meta.config.termsOfUse = 'please accept our tos'; | 		meta.config.termsOfUse = 'please accept our tos'; | ||||||
| 		request(nconf.get('url') + '/tos', function (err, res, body) { | 		request(nconf.get('url') + '/tos', function (err, res, body) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user