Browse Source

Fixed wrapUrl for inner URL

Close #1143
master
Igor Zhukov 8 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', []) @@ -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', []) @@ -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', []) @@ -1807,6 +1807,9 @@ angular.module('izhukov.utils', [])
}
}
}
else if (unsafe) {
url = 'tg://unsafe_url?url=' + encodeURIComponent(url);
}
return url;
}

2
app/js/messages_manager.js

@ -2234,7 +2234,7 @@ angular.module('myApp.services') @@ -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);
}
})
});

Loading…
Cancel
Save