Refined-github: `comments-time-machine-links` doesn't work with branches that have slashes

Created on 17 Mar 2020  路  7Comments  路  Source: sindresorhus/refined-github

All 7 comments

For files that still exist, this will be fixed by https://github.com/sindresorhus/refined-github/issues/2618

For deleted files, it's complex to fix it because branch/still-branch looks the same as branch/folder in the URL. Since the file is deleted, the URL is the only piece of information we have.

I looked into this. This is github's issue

#

Edit I missed the whole point of the comment 馃槅

Any time related url with a branch that has a slash that is not going to the root will fail

It's a GitHub "bug" in the sense that slashed/branch@{timestamp} URLs work for the root, but they stop working as soon as you open a file/folder. Please report it.

  1. Open https://github.com/Cog-Creators/Red-DiscordBot/tree/V3/develop@%7B2019-09-07T19:14:39Z%7D
  2. Open any file or folder

As for this specific bug, the URL that RGH generates is technically correct and detects the slashed/branch correctly:

https://github.com/Cog-Creators/Red-DiscordBot/blob/V3/develop@%7B2019-09-07T19:14:39Z%7D/redbot/core/events.py#L166

It's just that it doesn't work because of GitHub. I don't think this can be _fixed_ by us unless we drop the @{timestamp}

Please report it.

Submitted

Solution: don't use @{date} publicly.

We have to query the API to transform that {branch}@{date} into a commit

Easy temporary solution: use HEAD@{date} when the branch contains a slash. It's might not be correct, but it's better than a 404

Submitted

Hello yakov116,

Thanks for writing in, and we're really sorry it's taken so long to respond to you. Apologies for the delays.

I have looked into this, and unfortunately using reflog-based syntax like @{} in GitHub URLs isn't officially supported. This means that the syntax is not reliable and might change or be fully removed in the future. We previously had some examples of this syntax in our help docs, but the examples were removed last winter to prevent confusion.

Sorry about that, but please let us know if there is anything else we can do for you and we will be happy to assist!

Thanks,

Tammy
GitHub Support

Was this page helpful?
0 / 5 - 0 ratings