td icon indicating copy to clipboard operation
td copied to clipboard

Instant View for urls with caption

Open zevlg opened this issue 4 years ago • 3 comments

If I send message with url like https://ru.m.wikipedia.org/wiki/Моральный_кодекс_строителя_коммунизма#История_создания , new message gets web_page attached in the message content, however url of the web_page appears without "История_создания" caption.

Here is the cut from the logs:

[ 3][t 3][1586104798.879821777][MessagesManager.cpp:5270][#1][!net_actor]	Receive from on_updateNewMessage pending updateNewMessage {
  message = message {
    flags = 896
    id = 143034
    from_id = 82439953
    to_id = peerUser {
      user_id = 82439953
    }
    date = 1586104798
    message = "https://ru.m.wikipedia.org/wiki/Моральный_кодекс_строителя_коммунизма#История_создания"
    media = messageMediaWebPage {
      webpage = webPage {
        flags = 1039
        id = 1633011975046757226
        url = "https://ru.m.wikipedia.org/wiki/%D0%9C%D0%BE%D1%80%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B9_%D0%BA%D0%BE%D0%B4%D0%B5%D0%BA%D1%81_%D1%81%D1%82%D1%80%D0%BE%D0%B8%D1%82%D0%B5%D0%BB%D1%8F_%D0%BA%D0%BE%D0%BC%D0%BC%D1%83%D0%BD%D0%B8%D0%B7%D0%BC%D0%B0"
        display_url = "ru.m.wikipedia.org/wiki/Моральный_кодекс_строителя_коммунизма"
        hash = -1583138128
        type = "article"
        site_name = "Wikipedia"
        title = "Моральный кодекс строителя коммунизма"
        description = "12 кодифицированных моральных правил в СССР"
...

Is it possible somehow to keep that "История_создания" caption in the web_page url, so when Instant View is initiated by user, it will be possible to jump to the contents at that caption?

Thanks!

zevlg avatar Apr 05 '20 16:04 zevlg

Link preview doesn't depend on the anchor and this is unlikely to be changed. But if the URL in the message text contains an anchor, then clients try to open Instant View from the anchor's position. On Android it works with the provided URL only if the URL and the anchor exactly match the web page URL and the instant view anchor name: https://ru.m.wikipedia.org/wiki/%D0%9C%D0%BE%D1%80%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B9_%D0%BA%D0%BE%D0%B4%D0%B5%D0%BA%D1%81_%D1%81%D1%82%D1%80%D0%BE%D0%B8%D1%82%D0%B5%D0%BB%D1%8F_%D0%BA%D0%BE%D0%BC%D0%BC%D1%83%D0%BD%D0%B8%D0%B7%D0%BC%D0%B0#История_создания. The page is very short, so you need to open some details sections to see that opening instant view of this link really works. On iPhone neither of the link works, but it works on other sites for links not hidden in pageBlockDetails. So this looks like a Telegram apps bug.

levlam avatar Apr 09 '20 12:04 levlam

BTW: in Instant View for the https://core.telegram.org page, there is a link to "https://core.telegram.org/#tdlib--build-your-own-telegram", but internal anchor has "tdlib-build-your-own-telegram" name (single dash instead of double)

Is it some known notion or just a typo in the link?

Thanks

zevlg avatar Apr 18 '20 16:04 zevlg

@zevlg It was a misprint. Fixed now.

levlam avatar Apr 18 '20 17:04 levlam