hypothesis / viahtml

HTML proxying component for Via
BSD 2-Clause "Simplified" License
2 stars 4 forks source link

Resource URL rewritten by the client #311

Open kael opened 2 years ago

kael commented 2 years ago

Steps to reproduce

  1. Bookmark a GitHub page, e.g. : https://via.hypothes.is/https://github.com/pedroslopez/whatsapp-web.js
  2. The bookmarked resource URI is https://github.com/pedroslopez/whatsapp-web.js/sponsors_list?block_button=false&current_repository=whatsapp-web.js.

Notice also https://github.com/pedroslopez/whatsapp-web.js/overview_actions/main.

Also, I'm wondering if this is correct in the payload: "href": "https://viahtml.hypothes.is/proxy/https://github.com/pedroslopez/whatsapp-web.js?via.client.ignoreOtherConfiguration=1&via.client.openSidebar=1&via.external_link_mode=new-tab".

Payload sent (from Chrome console):

{
    "created": "2022-03-02T11:41:29.812Z",
    "group": "__world__",
    "permissions": {
        "read": [
            "group:__world__"
        ],
        "update": [
            "acct:kael@hypothes.is"
        ],
        "delete": [
            "acct:kael@hypothes.is"
        ]
    },
    "tags": [
        "foo"
    ],
    "text": "",
    "updated": "2022-03-02T11:41:29.812Z",
    "user": "acct:kael@hypothes.is",
    "user_info": {
        "display_name": "kael"
    },
    "hidden": false,
    "links": {},
    "document": {
        "title": "GitHub - pedroslopez/whatsapp-web.js: A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app",
        "link": [
            {
                "href": "https://viahtml.hypothes.is/proxy/https://github.com/pedroslopez/whatsapp-web.js?via.client.ignoreOtherConfiguration=1&via.client.openSidebar=1&via.external_link_mode=new-tab"
            },
            {
                "href": "https://github.com/pedroslopez/whatsapp-web.js",
                "rel": "canonical",
                "type": ""
            },
            {
                "href": "https://github.com/pedroslopez/whatsapp-web.js",
                "rel": "canonical",
                "type": ""
            },
            {
                "href": "https://github.com/pedroslopez/whatsapp-web.js/overview_actions/main",
                "rel": "canonical",
                "type": ""
            },
            {
                "href": "https://github.com/pedroslopez/whatsapp-web.js/sponsors_list?block_button=false&current_repository=whatsapp-web.js",
                "rel": "canonical",
                "type": ""
            }
        ],
        "dc": {},
        "eprints": {},
        "facebook": {
            "image": [
                "https://repository-images.githubusercontent.com/171072967/f0240000-b107-11ea-8c2e-02755c9b1505"
            ],
            "image:alt": [
                "A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app - GitHub - pedroslopez/whatsapp-web.js: A WhatsApp client library for NodeJS that connects through the WhatsA..."
            ],
            "site_name": [
                "GitHub"
            ],
            "type": [
                "object"
            ],
            "title": [
                "GitHub - pedroslopez/whatsapp-web.js: A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app"
            ],
            "url": [
                "https://github.com/pedroslopez/whatsapp-web.js"
            ],
            "description": [
                "A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app - GitHub - pedroslopez/whatsapp-web.js: A WhatsApp client library for NodeJS that connects through the WhatsA..."
            ]
        },
        "highwire": {},
        "prism": {},
        "twitter": {
            "image:src": [
                "https://repository-images.githubusercontent.com/171072967/f0240000-b107-11ea-8c2e-02755c9b1505"
            ],
            "site": [
                "@github"
            ],
            "card": [
                "summary_large_image"
            ],
            "title": [
                "GitHub - pedroslopez/whatsapp-web.js: A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app"
            ],
            "description": [
                "A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app - GitHub - pedroslopez/whatsapp-web.js: A WhatsApp client library for NodeJS that connects through the WhatsA..."
            ]
        },
        "favicon": "https://github.githubassets.com/favicons/favicon.svg"
    },
    "uri": "https://github.com/pedroslopez/whatsapp-web.js/sponsors_list?block_button=false&current_repository=whatsapp-web.js",
    "target": []
}

I've had noticed the same with that URL https://assistance.free.fr/articles/freewifi_secure-informations-avancees-943 which then turned into https://assistance.free.fr/articles/freewifi_secure-informations-avancees-943?search-text=

Addendum: It's not possible to delete the wrongly linked annotation then, as the URLs don't match and the user is not sent back to the wrong URL.

robertknight commented 2 years ago

This looks like an issue with Via. When visiting the page directly and executing document.querySelectorAll('link[rel=canonical]') in the browser console, only one element is returned with the correct URL. In Via however I saw 4, with different URLs:

Duplicate rel-canonical
kael commented 2 years ago

This looks like an issue with Via.

Indeed.

I've just re-tested with the bookmarklet for that link https://assistance.free.fr/articles/freewifi_secure-informations-avancees-943 and it got correctly bookmarked - I can't use the bookmarklet with GitHub, probably because of interacting installed Firefox extensions (NoScript, etc).