You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "amoeba (via GitHub)" <gi...@apache.org> on 2023/03/17 19:46:01 UTC

[GitHub] [arrow] amoeba commented on a diff in pull request #34524: GH-34421: [R] Let GcsFileSystem take a path for json_credentials

amoeba commented on code in PR #34524:
URL: https://github.com/apache/arrow/pull/34524#discussion_r1140646873


##########
r/R/filesystem.R:
##########
@@ -572,6 +572,11 @@ GcsFileSystem$create <- function(anonymous = FALSE, retry_limit_seconds = 15, ..
 
   options$retry_limit_seconds <- retry_limit_seconds
 
+  # Handle reading json_credentials from the filesystem
+  if ("json_credentials" %in% names(options) && file.exists(options[["json_credentials"]])) {
+    options[["json_credentials"]] <- paste(readLines(options[["json_credentials"]]), collapse = "")

Review Comment:
   > I forget the exact details but I think readLines() assumes system encoding (rather than UTF-8, which matters on Windows). Any thought as to which one of those is a better assumption if the value points to a file? (The workaround would be for the user to read in the file themselves first with an explicit encoding).
   
   Thanks for catching this point. You're right about readLines' behavior. To your question, I'm not entirely sure. If I test on my Windows 11 VM, the system-wide encoding is Windows 1252, but JSON files downloaded via Edge produces either ASCII or UTF-8 files. Maybe this just works or maybe just works on newer Win10/11 builds?
   
   > Also, did you want to collapse = "\n"?
   
   I suppose that's slightly better, though I think either works just the same. I'll change it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org