Fixed wrapUrl for inner URL

Close #1143
This commit is contained in:
Igor Zhukov 2016-06-07 14:12:42 +03:00
parent b5a60fef0b
commit f206be201d
2 changed files with 6 additions and 3 deletions

View File

@ -1624,7 +1624,7 @@ angular.module('izhukov.utils', [])
break;
}
var url = entity.url || entityText;
url = wrapUrl(url, entity._ == 'messageEntityTextUrl');
url = wrapUrl(url, entity._ == 'messageEntityTextUrl' ? 2 : false);
html.push(
'<a href="',
encodeEntities(url),
@ -1785,7 +1785,7 @@ angular.module('izhukov.utils', [])
url = 'http://' + url;
}
var tgMeMatch;
if (unsafe) {
if (unsafe == 2) {
url = 'tg://unsafe_url?url=' + encodeURIComponent(url);
}
else if ((tgMeMatch = url.match(/^https?:\/\/telegram\.me\/(.+)/))) {
@ -1807,6 +1807,9 @@ angular.module('izhukov.utils', [])
}
}
}
else if (unsafe) {
url = 'tg://unsafe_url?url=' + encodeURIComponent(url);
}
return url;
}

View File

@ -2234,7 +2234,7 @@ angular.module('myApp.services')
angular.forEach(markupRow.buttons, function (markupButton) {
markupButton.rText = RichTextProcessor.wrapRichText(markupButton.text, {noLinks: true, noLinebreaks: true});
if (markupButton._ == 'keyboardButtonUrl') {
markupButton.pUrl = RichTextProcessor.wrapUrl(markupButton.url, true);
markupButton.pUrl = RichTextProcessor.wrapUrl(markupButton.url, 1);
}
})
});