Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unneccessary check for non-ASCII filenames should be removed #272

Open
toreeriksson opened this issue Jul 31, 2024 · 0 comments
Open

Unneccessary check for non-ASCII filenames should be removed #272

toreeriksson opened this issue Jul 31, 2024 · 0 comments

Comments

@toreeriksson
Copy link

Currently, boxr checks for non-ASCII filenames in the function box_filename() implemented in boxr__internal_misc.R, and raises an error if any non-ASCII characters are present. However, the BOX API does not have any such restrictions.

Thus, if lines 7-12 of boxr__internal_misc.R are deleted, the package will work for non-English environments as well. I have tested this locally and was able to upload a file named テストファイル.txt without problems.

diff --git i/R/boxr__internal_misc.R w/R/boxr__internal_misc.R
index 9e50756..2deb343 100644
--- i/R/boxr__internal_misc.R
+++ w/R/boxr__internal_misc.R
@@ -4,12 +4,6 @@
 # supported are those that contain non-printable ascii, / or \, names with
 # trailing spaces, and the special names "." and "..".
 box_filename <- function(x) {
-  x <- iconv(x, from = "", to = "ascii")
-
-  if (is.na(x))
-    stop("box.com accepts only valid ASCII filenames. Filename conversion to",
-         " ASCII via iconv() failed. See ?Encoding")
-
   if (nchar(x) > 255)
     stop("box.com accepts only filenames of 255 characters or less. Filename ",
          "is ", nchar(x), " characters long.")
@toreeriksson toreeriksson changed the title Unneccessary check for non-ASCII filnames should be removed. Unneccessary check for non-ASCII filenames should be removed Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant