-
Notifications
You must be signed in to change notification settings - Fork 694
Opening a gist repository gives a fetch error #2933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I think the fix would be either to add {
"authority": "gist.github.com",
"fragment": "",
"path": "/20dec7376005dec0a1...",
"query": "",
"scheme": "https"
} |
|
This works for me for both diff --git a/src/authentication/githubServer.ts b/src/authentication/githubServer.ts
index a3859d4..dc87dc0 100644
--- a/src/authentication/githubServer.ts
+++ b/src/authentication/githubServer.ts
@@ -17,6 +17,11 @@ export class GitHubManager {
return false;
}
+ // gist repos are not supported
+ if (host.authority === 'gist.github.com' || /^\/[a-z0-9]+$/i.test(host.path)) {
+ return false;
+ }
+
if (this._servers.has(host.authority)) {
return !!this._servers.get(host.authority);
}EDIT: summary of what it works on:
I'm unaware if |
src/authentication/githubServer.ts
Outdated
| // .wiki repos are not supported | ||
| if (host.path.endsWith('.wiki')) { | ||
| // .wiki/.git repos are not supported | ||
| if (host.path.endsWith('.wiki') || host.path.match(/gist[.]github[.]com/g)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be a global regular expression match (/g)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't. What do you think of the proposed solution from @mcornella? It appears to handle the github.com case as well. I have no idea what that regex does, but his solution for gist.github.com looks more elegant than mine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually go here to visualize regular expressions: https://regexper.com/#%5E%5C%2F%5Ba-z0-9%5D%2B%24
I don't think we want to exclude all github hosts with non-alphanumeric characters in them (I have no idea how often those will occur with enterprise for example). I'm happy with the simple test that this PR uses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with ignoring that part and just check the domain name. For that though we need to check host.authority instead of host.path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the g for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@burkeholland, @mcornella is correct, it is host.authority then needs to be checked for gist.github.com.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented hostpath check as per @mcornella
alexr00
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just #2933 (comment) then we're good to merge.
alexr00
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't host.authority need to be checked instead of host.path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ready to merge now!
Fixes #2324