Skip to content

Check that URLs begin with http:// or https:// #1898

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

Merged
merged 2 commits into from
Nov 17, 2019

Conversation

jtgeibel
Copy link
Member

This switches to a manual check of the string prefix, because
Url::parse may sanitize URLs as they are parsed, making it
difficult to ensure both slashes are present.

Fixes: #169

Eventually it would be nice to return a vec of errors, to report if
multiple URLs fail.  In that case we could add additional examples of
relative URLs and ensure that all 3 URLs fail validation.  For now, the
test focuses only on the condition that is currently failing.

Refs: rust-lang#169
This switches to a manual check of the string prefix, because
`Url::parse` may sanitize URLs as they are parsed, making it
difficult to ensure both slashes are present.

Fixes: rust-lang#169
@rust-highfive
Copy link

r? @carols10cents

(rust_highfive has picked a reviewer for you, use r? to override)

@smarnach
Copy link
Contributor

This looks good to me.

@bors r+

@bors
Copy link
Contributor

bors commented Nov 17, 2019

📌 Commit b46821b has been approved by smarnach

@bors
Copy link
Contributor

bors commented Nov 17, 2019

⌛ Testing commit b46821b with merge ea248e1...

bors added a commit that referenced this pull request Nov 17, 2019
Check that URLs begin with `http://` or `https://`

This switches to a manual check of the string prefix, because
`Url::parse` may sanitize URLs as they are parsed, making it
difficult to ensure both slashes are present.

Fixes: #169
@bors
Copy link
Contributor

bors commented Nov 17, 2019

☀️ Test successful - checks-travis
Approved by: smarnach
Pushing ea248e1 to master...

@bors bors merged commit b46821b into rust-lang:master Nov 17, 2019
@jtgeibel jtgeibel deleted the issue-169 branch November 23, 2019 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enforce that external URIs in crate metadata must be absolute
5 participants