Meta links to Github often broken


(Ryan Erwin) #1

You can find a lot of references to code in github as you browse through meta.discourse.org, but many of the links no longer work…

I think one solution would be to require that a github permalink is posted (or at least warn the poster when their github link is not a permalink).

I’ve come across dozens of them today. For example, see “How Discourse Stays Online - (Message Bus, Faye, Long Polling)

You just hit y to get a Permalink on Github.

So many broken links makes meta more difficult to use. Considering these links are typically posted by the Discourse founders, all the more likely to be followed into the future…

There are probably some exceptions that you’re 99% sure will stay around, such as README.md, but search for “https://github.com/discourse/discourse/blob/master/” and see how many of these are no longer valid.


(Régis Hanol) #2

I don’t know when the permalink feature was added but I only knew about it with this announcement

The post you mentioned is far older than that announcement :wink:


(Matt Palmer) #3

Yes, links break over time. This is not specific to meta, or Discourse, or even Github. Does Github provide a stable means of determining whether a URL is a permalink based on its structure? If not, it’s going to be awfully tricky to implement a warning.


(Michael Howell) #4

If you have a URL with this format:

https://github.com/:owner/:repo/blob/:commit/:file

You can figure out if it’s a permalink by hitting this URL:

https://api.github.com/repos/:owner/:repo/commits/:commit

If the returned SHA is equal to :commit itself, then it’s a permalink. Otherwise, it’s not. Personally, I’d just rewrite non-permalinks into permalinks automatically, though.