Meta 链接到 GitHub 经常失效

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.

2 个赞