Skip to content

Commit 21600e4

Browse files
committed
Fix the check for service account JSON
Fixes tidyverse/googledrive#437
1 parent 9ed6f38 commit 21600e4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

R/credentials_service_account.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ check_is_service_account <- function(path, hint, call = caller_env()) {
8585
return(invisible())
8686
}
8787

88-
tryCatch(
89-
info <- jsonlite::fromJSON(path, simplifyVector = FALSE),
90-
error = NULL
88+
info <- tryCatch(
89+
jsonlite::fromJSON(path, simplifyVector = FALSE),
90+
error = function(e) NULL
9191
)
9292

93-
if (!is.null(info) && !identical(info[["type"]], "service_account")) {
93+
if (is.null(info) || !identical(info[["type"]], "service_account")) {
9494
cli::cli_abort(c(
9595
"{.arg path} does not represent a service account.",
9696
"Did you provide the JSON for an OAuth client instead of for a \\

0 commit comments

Comments
 (0)