Skip to content
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

Allow scheme-less clone URLs #3792

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

willibrandon
Copy link
Contributor

Summary of the pull request

Allow scheme-less clone URLs.

References and relevant issues

Fixes #3629

Detailed description of the pull request / Additional comments

Validation steps performed

PR checklist

  • Closes #xxx
  • Tests added/passed
  • Documentation updated

@dhoehna
Copy link
Contributor

dhoehna commented Sep 6, 2024

Did you test this with the GitHub extension? I believe a non-https URL is rejected via the extension.

@willibrandon
Copy link
Contributor Author

Did you test this with the GitHub extension? I believe a non-https URL is rejected via the extension.

I did not test this with the GitHub extension yet but I did notice the comment UriBuilder prepends the https scheme on line 1196 which isn't accurate given the version of the UriBuilder constructor currently being used on line 1201 UriBuilder(String), which defaults to "http" if a scheme isn't specified in the URI string. To default the scheme to "https" when a scheme isn't specified, we could use UriBuilder(String, String) which accepts a schemeName and hostName.

e.g.,

var uriBuilder = new UriBuilder(schemeName: Uri.UriSchemeHttps, hostName: uri.OriginalString)
{
    Port = -1,
};

I'll test this with the GitHub extension now and will update it to use "https" if a scheme is not specified.

@willibrandon
Copy link
Contributor Author

Did you test this with the GitHub extension? I believe a non-https URL is rejected via the extension.

It looks like the GitHub extension allows both http and https schemes in the uri string which confirms what I see while testing.
https://github.com/microsoft/devhomegithubextension/blob/9e343dc7567092e2082f37fb8e24aafed5e2b7a0/src/GitHubExtension/Client/Validation.cs#L16-L20

However I do think we should default to https if a scheme is not specified in the uri string.

@dhoehna dhoehna added the Needs-Second Pull request that needs another approval label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Second Pull request that needs another approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow URL without "https" for cloning
2 participants