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

Thrown an error if the repo path contains the protocol #1533

Merged
merged 2 commits into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

* ![Enhancement][badge-enhancement] `deploydocs` now throws an error if something goes wrong with the Git invocations used to deploy to `gh-pages`. ([#1529][github-1529])

* ![Bugfix][badge-bugfix] A bad `repo` argument to `deploydocs` containing a protocol now throws an error instead of being misinterpreted. ([#1531][github-1531], [#1533][github-1533])

## Version `v0.26.2`

* ![Enhancement][badge-enhancement] `doctest()` no longer throws an error if cleaning up the temporary directory fails for some reason. ([#1513][github-1513], [#1526][github-1526])
Expand Down Expand Up @@ -756,6 +758,8 @@
[github-1526]: https://github.com/JuliaDocs/Documenter.jl/pull/1526
[github-1527]: https://github.com/JuliaDocs/Documenter.jl/pull/1527
[github-1529]: https://github.com/JuliaDocs/Documenter.jl/pull/1529
[github-1531]: https://github.com/JuliaDocs/Documenter.jl/issues/1531
[github-1533]: https://github.com/JuliaDocs/Documenter.jl/pull/1533

[julia-38079]: https://github.com/JuliaLang/julia/issues/38079

Expand Down
2 changes: 2 additions & 0 deletions src/Documenter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,8 @@ Disassemble repo address into user, host, and path to repo. If no user is given,
"git". Reassemble user, host and path into an upstream to `git push` to.
"""
function user_host_upstream(repo)
# If the repo path contains the protocol, throw immediately an error.
occursin(r"^[a-z]+://", repo) && error("The repo path $(repo) should not contain the protocol")
#= the regex has three parts:
(?:([^@]*)@)? matches any number of characters up to the first "@", if present,
capturing only the characters before the "@" - this captures the username
Expand Down
1 change: 1 addition & 0 deletions test/deployconfig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ end
uhu = Documenter.user_host_upstream("[email protected]:/path/to/repo")
@test uhu == ("user", "subdom.long-page.com", "[email protected]:path/to/repo")

@test_throws ErrorException Documenter.user_host_upstream("https://github.com/JuliaDocs/Documenter.jl.git")
@test_throws ErrorException Documenter.user_host_upstream("[email protected]")
end

Expand Down