diff --git a/DESCRIPTION b/DESCRIPTION index 0dca172..53464b3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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", , "mark.padgham@email.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-2172-5265")) diff --git a/R/dl_repo.R b/R/dl_repo.R index 821cf35..48fb82f 100644 --- a/R/dl_repo.R +++ b/R/dl_repo.R @@ -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] diff --git a/codemeta.json b/codemeta.json index 1cde987..3edd6c6 100644 --- a/codemeta.json +++ b/codemeta.json @@ -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",