Browse Source

Fixed wrapUrl for inner URL

Close #1143
master
Igor Zhukov 9 years ago
parent
commit
f206be201d
  1. 7
      app/js/lib/ng_utils.js
  2. 2
      app/js/messages_manager.js

7
app/js/lib/ng_utils.js

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

2
app/js/messages_manager.js

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

Loading…
Cancel
Save