{"action":"created","issue":{"url":"https://api.github.com/repos/thelounge/lounge/issues/1180","repository_url":"https://api.github.com/repos/thelounge/lounge","labels_url":"https://api.github.com/repos/thelounge/lounge/issues/1180/labels{/name}","comments_url":"https://api.github.com/repos/thelounge/lounge/issues/1180/comments","events_url":"https://api.github.com/repos/thelounge/lounge/issues/1180/events","html_url":"https://github.com/thelounge/lounge/issues/1180","id":230216089,"number":1180,"title":"Link prefetch 404 will still get pushed to the client","user":{"login":"Raqbit","id":11144180,"avatar_url":"https://avatars1.githubusercontent.com/u/11144180?v=3","gravatar_id":"","url":"https://api.github.com/users/Raqbit","html_url":"https://github.com/Raqbit","followers_url":"https://api.github.com/users/Raqbit/followers","following_url":"https://api.github.com/users/Raqbit/following{/other_user}","gists_url":"https://api.github.com/users/Raqbit/gists{/gist_id}","starred_url":"https://api.github.com/users/Raqbit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Raqbit/subscriptions","organizations_url":"https://api.github.com/users/Raqbit/orgs","repos_url":"https://api.github.com/users/Raqbit/repos","events_url":"https://api.github.com/users/Raqbit/events{/privacy}","received_events_url":"https://api.github.com/users/Raqbit/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-05-21T12:02:30Z","updated_at":"2017-05-27T19:31:07Z","closed_at":null,"body":"When someone posts a link with prefetch enabled, thelounge will copy the page's og:image meta tag url to get a thumbnail to show with the link description.\r\n[Where this is done](https://github.com/thelounge/lounge/blob/master/src/plugins/irc-events/link.js#L58)\r\nNormally this works fine, and thelounge will check the image size and everything.\r\n\r\nBut, if there's an issue with that url (it's relative to the site, or isn't there at all), which would 404 when fetched, thelounge still pushes the url to the client, which will 404.\r\n\r\nThe way @PolarizedIons and me found out about this is because we share an instance, and he kept getting 404's, which got him banned using fail2ban. Looking at some nginx logs (I'm using a nginx reverse proxy), we were able to find the source of this 404: His client was trying to load an image from my server, related to github. After some more investigation we found out that anonymous github gists have an og:image meta tag with a relative url. (which as a sidenote, will still 404 when used relative to the gist url)\r\n\r\nA suggested fix would be to check if the image url 404s before pushing it to the client.\r\n\r\nMany thanks to @PolarizedIons for finding the core cause of this issue! "},"comment":{"url":"https://api.github.com/repos/thelounge/lounge/issues/comments/304471922","html_url":"https://github.com/thelounge/lounge/issues/1180#issuecomment-304471922","issue_url":"https://api.github.com/repos/thelounge/lounge/issues/1180","id":304471922,"user":{"login":"slurdge","id":1651201,"avatar_url":"https://avatars3.githubusercontent.com/u/1651201?v=3","gravatar_id":"","url":"https://api.github.com/users/slurdge","html_url":"https://github.com/slurdge","followers_url":"https://api.github.com/users/slurdge/followers","following_url":"https://api.github.com/users/slurdge/following{/other_user}","gists_url":"https://api.github.com/users/slurdge/gists{/gist_id}","starred_url":"https://api.github.com/users/slurdge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slurdge/subscriptions","organizations_url":"https://api.github.com/users/slurdge/orgs","repos_url":"https://api.github.com/users/slurdge/repos","events_url":"https://api.github.com/users/slurdge/events{/privacy}","received_events_url":"https://api.github.com/users/slurdge/received_events","type":"User","site_admin":false},"created_at":"2017-05-27T19:31:07Z","updated_at":"2017-05-27T19:31:07Z","body":"It also seems that if there is an error downloading, the res will be empty, causing all sort of troubles [here](\r\nhttps://github.com/thelounge/lounge/blob/master/src/plugins/irc-events/link.js#L48)\r\nHowever I don't see the error happing when I paste an invalid link inside lounge. So maybe the catch [here](https://github.com/thelounge/lounge/blob/master/src/plugins/irc-events/link.js#L92) isn't useful."}}
{"actor":{"display_login":"slurdge"}}