Skip to content

Commit

Permalink
deploydocs: check that target is subdirectory of root (#2019)
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenpi committed Jan 20, 2023
1 parent 7560548 commit 452624b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -33,6 +33,7 @@
* ![Enhancement][badge-enhancement] The new `pagesonly` keyword to `makedocs` can be used to restrict builds to just the Markdown files listed in `pages` (as opposed to all `.md` files under `src/`). ([#1980][github-1980])
* ![Enhancement][badge-enhancement] Search engine and social media link previews are now supported, with Documenter generating the relevant HTML `meta` tags. ([#1321][github-1321], [#1991][github-1991])
* ![Enhancement][badge-enhancement] `deploydocs` now supports custom tag prefixes; see section "Deploying from a monorepo" in the docs. ([#1291][github-1291], [#1792][github-1792], [#1993][github-1993])
* ![Enhancement][badge-enhancement] The `target` keyword of `deploydocs` is now required to point to a subdirectory of `root` (usually the directory where `make.jl` is located). ([#2019][github-2019])
* ![Bugfix][badge-bugfix] Documenter now generates the correct source URLs for docstrings from other packages when the `repo` argument to `makedocs` is set (note: the source links to such docstrings only work if the external package is cloned from GitHub and added as a dev-dependency). However, this change **breaks** the case where the `repo` argument is used to override the main package/repository URL, assuming the repository is cloned from GitHub. ([#1808][github-1808])
* ![Bugfix][badge-bugfix] Documenter no longer uses the `TRAVIS_REPO_SLUG` environment variable to determine the Git remote of non-main repositories (when inferring it from the Git repository configuration has failed), which could previously lead to bad source links. ([#1881][github-1881])
* ![Bugfix][badge-bugfix] Line endings in Markdown source files are now normalized to `LF` before parsing, to work around [a bug in the Julia Markdown parser][julia-29344] where parsing is sensitive to line endings, and can therefore cause platform-dependent behavior. ([#1906][github-1906])
Expand Down Expand Up @@ -1190,6 +1191,7 @@
[github-1993]: https://github.com/JuliaDocs/Documenter.jl/pull/1993
[github-2012]: https://github.com/JuliaDocs/Documenter.jl/pull/2012
[github-2018]: https://github.com/JuliaDocs/Documenter.jl/pull/2018
[github-2019]: https://github.com/JuliaDocs/Documenter.jl/pull/2019
<!-- end of issue link definitions -->

[julia-29344]: https://github.com/JuliaLang/julia/issues/29344
Expand Down
5 changes: 5 additions & 0 deletions src/deploydocs.jl
Expand Up @@ -241,6 +241,11 @@ function deploydocs(;

@debug "setting up target directory."
isdir(target) || mkpath(target)
startswith(realpath(target), realpath(root)) || error("""
target must be a subdirectory of root, got:
target: $(realpath(target))
root: $(realpath(root))
""")
# Run extra build steps defined in `make` if required.
if make !== nothing
@debug "running extra build steps."
Expand Down

0 comments on commit 452624b

Please sign in to comment.