sindresorhus/refined-github

`comments-time-machine-links` doesn't work with branches that have slashes #2901

jack1142 posted onGitHub


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.

posted by fregante about 5 years ago

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

posted by yakov116 almost 5 years ago

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
posted by fregante almost 5 years ago

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}

posted by fregante almost 5 years ago

Please report it.

Submitted

posted by yakov116 almost 5 years ago

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

posted by fregante over 4 years ago

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 <refname>@{<date>} 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

posted by yakov116 over 4 years ago

Fund this Issue

$0.00
Funded

Pull requests