Github onebox broken for some link types

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:

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:

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?

1 Like

As usual, try it on iframely.com/debug 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.

3 Likes

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)

I’m also seeing problems:

https://meta.discourse.org/t/start-a-topic-by-pasting-a-link-like-reddit/54071/76?u=chrisbeach

2 Likes

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.
https://iframely.com/embed/https%3A%2F%2Fgithub.com%2Fdiscourse%2Fdiscourse

8 Likes

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: https://iframely.com/embed/https%3A%2F%2Fgithub.com%2Fdiscourse%2Fdiscourse%2Fblob%2Fmaster%2FCONTRIBUTING.md but then Discourse itself / onebox happily embeds it:

https://github.com/discourse/discourse/blob/master/CONTRIBUTING.md

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

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