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

Allow source url to omit trailing slash #2481

Merged
merged 3 commits into from
Apr 23, 2024
Merged

Allow source url to omit trailing slash #2481

merged 3 commits into from
Apr 23, 2024

Conversation

hadley
Copy link
Member

@hadley hadley commented Apr 22, 2024

Fixes #2017

@hadley hadley requested a review from maelle April 22, 2024 14:38
@@ -20,9 +20,11 @@ repo_source <- function(pkg, paths) {
return()
}

needs_slash <- !grepl("/$", url$source) & !grepl("^/", paths)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

give a name to !grepl("^/", paths) to explauin why it's needed? not_relative_links?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also should it be need_slashes or need_slash given it's applied to several things at once 💅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmmm, it seems clear to me already because I'm thinking that you need to add a slash if there isn't one on either the left of the right.

tests/testthat/test-repo.R Outdated Show resolved Hide resolved
tests/testthat/test-repo.R Outdated Show resolved Hide resolved
tests/testthat/test-repo.R Outdated Show resolved Hide resolved
@hadley hadley merged commit 6910ce5 into main Apr 23, 2024
12 checks passed
@hadley hadley deleted the repo-paths branch April 23, 2024 13:48
SebKrantz pushed a commit to SebKrantz/pkgdown that referenced this pull request Jun 1, 2024
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.

Add robustness to repo source not having a slash
2 participants