Closed pointcache closed 2 years ago
Hello,
Thank you for your feedback. I do not have a private GitLab for testing it, but based on what I'm reading online, it looks like permalink (link to a file, to a specific commit) looks like the following:
{base}/{repository}/-/blob/{ref}/{file}
So it sounds like user/repo blob/eae7f475ff2efa34e8asd559062baeab0/src/Something/File.cs#L27-27
should be transformed to user/repo/-/blob/eae7f475ff2efa34e8asd559062baeab0/src/Something/File.cs#L27-27
Can you please confirm whether such a URL would work?
@hmaiga , if I recall correctly, you are familiar with GitLab Enterprise. Would you be able to confirm my assumption?
Thank you :)
Hi 👋, I'm checking and will come back to you asap @veler .
Hi @pointcache, On my side, i cannot reproduce this issue. The only scenario in which you will have this 404 error is when the commit ref in the permalink has not been pushed on the remote server. The behavior is the same for Gitlab Entreprise or Github.
Example: The url format: {base}/{repository}/-/blob/{ref|branch_name}/{file}
Case 1: These two links will lead you to the same code snippet version
https://github.com/veler/CopyGitLink/blob/805d6d7ba16ff8fdc1ca4fd3d8b0ccf4176f3d33/src/Tests/CopyGitLink.Tests/Core/GitOnlineServices/GitHubnLabTests.cs#L53-L62
=> Ok
NB: This is our main
branch last commit long hash: 805d6d7ba16ff8fdc1ca4fd3d8b0ccf4176f3d33
. A quick git rev-parse HEAD
will give you this commit hashCase 2: So for this case let's try to use a fake commit hash, that means this commit is not known by the remote server: 805d6d7ba16ff8fdc1ca4fd3d8b0ccf4176f3d40
So for your case @pointcache, could you double check and be sure that this commit eae7f475ff2efa34e8asd559062baeab0
has been pushed on your remote server please ?
Thanks @hmaiga for this! Super helpful! On a side note, perhaps a UX could be provided for when a commit isn't pushed yet.
Can't replicate anymore, youre most likely right, if i run into it again ill just read this page. Thank for you for this ext, extremely helpful.
The working link is user/repo
-/blob/main/src/Something/File.cs
your link user/repoblob/eae7f475ff2efa34e8asd559062baeab0/src/Something/File.cs#L27-27
Which gives me 404 even tho im logged in and have access to the repository. I would really like to use this extension.