Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

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
@krschau krschau removed the Needs-Second Pull request that needs another approval label Sep 25, 2024
@dhoehna dhoehna merged commit 3ab6c05 into microsoft:main Sep 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow URL without "https" for cloning

3 participants