<commit_before>$.Redactor.prototype.WoltLabLink = function() {
	"use strict";
	
	var _dialogApi = null;
	
	return {
		init: function() {
			this.link.isUrl = (function(url) {
				//var pattern = '((xn--)?[\\W\\w\\D\\d]+(-[\\W\\w\\D\\d]+)*\\.)+[\\W\\w]{2,}';
				// WoltLab modification: prevent catastrophic backtracing
				var pattern = '((xn--)?[\\W\\w\\D\\d]+(-(?!-[\\W\\w\\D\\d])+)*\\.)+[\\W\\w]{2,}';
				
				// WoltLab modification: added `steam` and `ts3server`
				var re1 = new RegExp('^(http|ftp|https|steam|ts3server)://' + pattern, 'i');
				var re2 = new RegExp('^' + pattern, 'i');
				var re3 = new RegExp('\.(html|php)$', 'i');
				var re4 = new RegExp('^/', 'i');
				var re5 = new RegExp('^tel:(.*?)', 'i');
				
				// add protocol
				if (url.search(re1) === -1 && url.search(re2) !== -1 && url.search(re3) === -1 && url.substring(0, 1) !== '/')
				{
					url = 'http://' + url;
				}
				
				if (url.search(re1) !== -1 || url.search(re3) !== -1 || url.search(re4) !== -1 || url.search(re5) !== -1)
				{
					return url;
				}
				
				return false;
			}).bind(this);
			
			this.link.show = this.WoltLabLink.show.bind(this);
			
			this.link.parse = (function(link) {
				// mailto
				if (this.link.isMailto(link.url))
				{
					link.url = 'mailto:' + link.url.replace('mailto:', '');
				}
				// url
				else if (link.url.search('#') !== 0)
				{
					if (this.opts.linkValidation)
					{
						var url = this.link.isUrl(link.url);
						if (url === false) url = 'http://' + link.url;
						
						link.url = url;
					}
				}
				
				// empty url or text or isn't url
				return (this.link.isEmpty(link) || link.url === false) ? false : link;<commit_msg>Default to `https` for protocol-less links<commit_after>$.Redactor.prototype.WoltLabLink = function() {
	"use strict";
	
	var _dialogApi = null;
	
	return {
		init: function() {
			this.link.isUrl = (function(url) {
				//var pattern = '((xn--)?[\\W\\w\\D\\d]+(-[\\W\\w\\D\\d]+)*\\.)+[\\W\\w]{2,}';
				// WoltLab modification: prevent catastrophic backtracing
				var pattern = '((xn--)?[\\W\\w\\D\\d]+(-(?!-[\\W\\w\\D\\d])+)*\\.)+[\\W\\w]{2,}';
				
				// WoltLab modification: added `steam` and `ts3server`
				var re1 = new RegExp('^(http|ftp|https|steam|ts3server)://' + pattern, 'i');
				var re2 = new RegExp('^' + pattern, 'i');
				var re3 = new RegExp('\.(html|php)$', 'i');
				var re4 = new RegExp('^/', 'i');
				var re5 = new RegExp('^tel:(.*?)', 'i');
				
				// add protocol
				if (url.search(re1) === -1 && url.search(re2) !== -1 && url.search(re3) === -1 && url.substring(0, 1) !== '/')
				{
					url = 'https://' + url;
				}
				
				if (url.search(re1) !== -1 || url.search(re3) !== -1 || url.search(re4) !== -1 || url.search(re5) !== -1)
				{
					return url;
				}
				
				return false;
			}).bind(this);
			
			this.link.show = this.WoltLabLink.show.bind(this);
			
			this.link.parse = (function(link) {
				// mailto
				if (this.link.isMailto(link.url))
				{
					link.url = 'mailto:' + link.url.replace('mailto:', '');
				}
				// url
				else if (link.url.search('#') !== 0)
				{
					if (this.opts.linkValidation)
					{
						var url = this.link.isUrl(link.url);
						if (url === false) url = 'https://' + link.url;
						
						link.url = url;
					}
				}
				
				// empty url or text or isn't url
				return (this.link.isEmpty(link) || link.url === false) ? false : link;
{'fraction_non_alphanumeric': 0.24963246104087033, 'fraction_numerical': 0.015289620699794178, 'mean_word_length': 2.1883786316776006, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1089016', 'n_tokens_mistral': 1668, 'n_tokens_neox': 1302, 'n_words': 254}