Skip to content

Commit

Permalink
fix dl_repo when url includes sub-dir #64
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Nov 11, 2024
1 parent 60bc201 commit 1046ff9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: roreviewapi
Title: Plumber API to report package structure and function
Version: 0.1.0.061
Version: 0.1.0.062
Authors@R:
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-2172-5265"))
Expand Down
12 changes: 12 additions & 0 deletions R/dl_repo.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
#' @export
dl_gh_repo <- function (u, branch = NULL) {

subdir <- get_subdir_from_url (u)
if (length (subdir) > 0L) {
domains <- strsplit (u, "\\/+") [[1]] [-1] # rm "https"
i <- which (domains == "tree")
if (length (i) == 0L) {
stop ("URL [", u, "] is improperly formatted.", call. = FALSE)
}
u <- paste0 (
"https://",
paste0 (domains [seq_len (i - 1)], collapse = "/")
)
}
repo <- utils::tail (strsplit (u, "/") [[1]], 1)
org <- utils::tail (strsplit (u, "/") [[1]], 2) [1]

Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"codeRepository": "https://github.com/ropensci-review-tools/roreviewapi",
"issueTracker": "https://github.com/ropensci-review-tools/roreviewapi/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.1.0.061",
"version": "0.1.0.062",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down

0 comments on commit 1046ff9

Please sign in to comment.