mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	fix: isUri helper so that it passes ci tests
This commit is contained in:
		| @@ -14,13 +14,24 @@ const webfingerCache = ttl({ ttl: 1000 * 60 * 60 * 24 }); // 24 hours | |||||||
|  |  | ||||||
| const Helpers = module.exports; | const Helpers = module.exports; | ||||||
|  |  | ||||||
| Helpers.isUri = value => validator.isURL(value, { | Helpers.isUri = (value) => { | ||||||
| 	require_protocol: true, | 	if (typeof value !== 'string') { | ||||||
| 	require_host: true, | 		value = String(value); | ||||||
| 	protocols: ['https'], | 	} | ||||||
| 	require_valid_protocol: true, |  | ||||||
| 	require_tld: false, // temporary — for localhost | 	const protocols = ['https']; | ||||||
| }); | 	if (process.env.CI === 'true') { | ||||||
|  | 		protocols.push('http'); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return validator.isURL(value, { | ||||||
|  | 		require_protocol: true, | ||||||
|  | 		require_host: true, | ||||||
|  | 		protocols, | ||||||
|  | 		require_valid_protocol: true, | ||||||
|  | 		require_tld: false, // temporary — for localhost | ||||||
|  | 	}); | ||||||
|  | }; | ||||||
|  |  | ||||||
| Helpers.query = async (id) => { | Helpers.query = async (id) => { | ||||||
| 	const [username, hostname] = id.split('@'); | 	const [username, hostname] = id.split('@'); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user