Harmonize, clarify, categorize URL schemes

Regular expression + avoid-redirection list now match each other.
This commit is contained in:
Mikael Nordfeldth 2016-01-24 12:47:31 +01:00
parent 1cec627d72
commit a9d18a077e
2 changed files with 7 additions and 2 deletions

View File

@ -312,15 +312,20 @@ class File_redirection extends Managed_DataObject
$out_url = str_replace('.-()', '', $out_url);
break;
// non-HTTP schemes, so no redirects
case 'bitcoin':
case 'mailto':
case 'magnet':
case 'aim':
case 'jabber':
case 'xmpp':
// don't touch anything
break;
// URLs without domain name, so no redirects
case 'magnet':
// don't touch anything
break;
default:
$out_url = $default_scheme . ltrim($out_url, '/');
$p = parse_url($out_url);

View File

@ -885,7 +885,7 @@ function common_replace_urls_callback($text, $callback, $arg = null) {
'(?:'.
'(?:(?:https?|ftps?|mms|rtsp|gopher|news|nntp|telnet|wais|file|prospero|webcal|ircs?)://)'.
'|'.
'(?:(?:bitcoin|mailto|aim|tel|xmpp):)'.
'(?:(?:aim|bitcoin|fax|jabber|mailto|tel|xmpp):)'.
')'.
'(?:[\pN\pL\-\_\+\%\~]+(?::[\pN\pL\-\_\+\%\~]+)?\@)?'. //user:pass@
'(?:'.