thomasp85 / shinyFiles

A shiny extension for server side file access
196 stars 47 forks source link

parseFilePaths is.na errors #159

Closed lz100 closed 3 years ago

lz100 commented 3 years ago

My R has this stricter checks for || to check the length 1, so the following code in parseFilePaths no longer works

if (is.null(selection) || is.na(selection) || is.integer(selection) ||  length(selection$files) == 0) 

I know if I use input$xxx from fileButton to pass to the selection, it is a list of more than one item so it will fail. To reproduce:

Sys.setenv(`_R_CHECK_LENGTH_1_LOGIC2_`='true')
Sys.setenv(`_R_CHECK_LENGTH_1_CONDITION_`='true')
roots <- c(cur=getwd())
selection <- list(1,2)
shinyFiles::parseFilePaths(roots, selection)
vnijs commented 3 years ago

Thanks for reporting @lz100. Please try out the development version

remotes::install_github("thomasp85/shinyFiles", upgrade = "never")
lz100 commented 3 years ago

Thanks, this fixed the issue.