Github onebox broken for some link types


(Gergely Imreh) #1

Discourse has really great preview cards for links in general, dropping in a link on a new line (onebox previews).

Recently I’ve found, though, that Github repository links no longer have any previews (I think they had before), while linking to a specific file on Github has. For example posting https://github.com/resin-io-playground/awesome-resin-io:

^^ this has no preview (at the time of posting)

But posting a link to a file in the repo, e.g. https://github.com/resin-io-playground/awesome-resin-io/blob/master/readme.md:

^^ this has proper preview

I know it worked before, because in our Discourse the first link works, looking like this screenshot:

I suspect it has to do with Github’s recent style changes (as that happened less than a week ago, and the working screenshot is from 14 days ago).

I also think that besides broken repo links, organization links also regressed, but don’t have a previous working example at hand to double-check.

Any thoughts?


Start a topic by pasting a link (like Reddit)
(Jeff Atwood) #2

As usual, try it on Iframely URL Debugger - Open Graph, Twitter Cards, oEmbed and see what you get. Remember oneboxes require proper OpenGraph or oEmbed support.

If it worked before, and you’re on the same version of Discourse, then maybe something did change on their end.


(Gergely Imreh) #3

Since we are on hosted Discourse (on Discourse), I can’t really tell whether the version is the same or not. :confused:

Trying iframely with the first link (the one that doesn’t have any preview anymore) and the second (that still has) gives the same exact result, extracting info seemingly correctly.

You mean on Github’s? They seem to have updated their design (styling) as mentioned above, so that might cause issues extracting stuff, but iframely seems to say that at least the part they test for works? (even though I’m not sure if the extracted text/icons are the same as they were presented in the onebox before, or how the iframely test really compares to what the onebox should show)


#4

I’m also seeing problems:


(cpradio) #5

Watching the Dev Tools Network Tab, onebox is returning a 404 for the given URL, it seems this isn’t the only URL it is doing that for either.

Does it for the Official Discourse Repo too, the issue is with onebox

Network Tools info:

General: (user_id and ip removed intentionally)

Request URL:https://meta.discourse.org/onebox?url=https%3A%2F%2Fgithub.com%2Fdiscourse%2Fdiscourse&refresh=true&user_id=snipped
Request Method:GET
Status Code:404 
Remote Address: snipped

Query Parameters:

url:https://github.com/discourse/discourse
refresh:true
user_id:snipped

Edit: Looking at this again, I think GitHub broke this. I could have sworn they used to provide og/oembed tags on the Repo landing page, but now it is definitely not there.
Iframely API for Responsive oEmbed


(Gergely Imreh) #6

It seems to me, that it might be more complicated than that…

For example take a specific file from a repo: discourse/CONTRIBUTING.md at master · discourse/discourse · GitHub The iframely link says no embed code: Iframely API for Responsive oEmbed but then Discourse itself / onebox happily embeds it:

If iframely was correct, then neither the repo link, nor the file link would work. But one does and the other doesn’t…


(Jeff Atwood) #7

Gists have special support and have for a long time. There is generic oembed / opengraph and hard coded special support. Two different things.