Skip to content

Commit

Permalink
moved stop aroudn to fail quicker
Browse files Browse the repository at this point in the history
  • Loading branch information
muschellij2 committed Jan 21, 2021
1 parent 8c9e8b8 commit e4c7b7e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions R/remote_package_dcf.R
Expand Up @@ -35,6 +35,11 @@ get_remote_package_dcf = function(

tmp <- tempfile()
api_call = grepl("api", tolower(url))
if (api_call) {
if (!requireNamespace("base64enc", quietly = TRUE)) {
stop("base64enc needed for API calls")
}
}
if (!api_call) {
path <- paste(c(
remote$username,
Expand Down Expand Up @@ -67,15 +72,15 @@ get_remote_package_dcf = function(
}
} else {
if (api_call) {
if (!requireNamespace("base64enc", quietly = TRUE)) {
stop("base64enc needed for API calls")
}
data = httr::content(req)$content
data = base64enc::base64decode(what = data)
data = rawToChar(data)
writeLines(data, tmp)
}
}
if (is.na(tmp)) {
warning("Request to GitHub API did not result in a DCF file download")
}
names(tmp) = remotes
return(tmp)
}
Expand Down

0 comments on commit e4c7b7e

Please sign in to comment.