Skip to content

Commit

Permalink
trim whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau committed Feb 28, 2024
1 parent 3a8eeaa commit a245dba
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# r.releases.utils 0.0.1.9000 (development)

# r.releases.utils 0.0.2

* Trim white space when processing URLs.

# r.releases.utils 0.0.1

Expand Down
3 changes: 2 additions & 1 deletion R/assert_package.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ assert_package <- function(path) {
if (!file.exists(path)) {
stop(paste("file", shQuote(path), "does not exist"))
}
name <- basename(path)
name <- trimws(basename(path))
url <- try(readLines(path, warn = FALSE), silent = TRUE)
if (inherits(url, "try-error")) {
stop(paste("Problem reading file", shQuote(path)))
Expand All @@ -30,6 +30,7 @@ assert_package_contents <- function(name, url) {
if (!is_character_scalar(url)) {
stop("Invalid package URL")
}
url <- trimws(url)
good_url <- grepl(
pattern = "^https?://[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,3}(/\\S*)?$",
x = url
Expand Down
4 changes: 2 additions & 2 deletions R/build_universe.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ build_universe <- function(input = getwd(), output = "packages.json") {
warn = FALSE
)
out <- data.frame(
package = basename(packages),
url = urls,
package = trimws(basename(packages)),
url = trimws(urls),
branch = "*release"
)
if (!file.exists(dirname(output))) {
Expand Down
1 change: 1 addition & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ GitLab
JSON
json
repo
pkgdown

0 comments on commit a245dba

Please sign in to comment.