Skip to content

Commit

Permalink
Throw an error if the repo path contains the protocol (#1533)
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano authored Feb 23, 2021
1 parent 4be8243 commit 80a86d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
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

0 comments on commit 80a86d7

Please sign in to comment.