File Read Request silently crashes with spaces in file name

During the course of building a small song book sample, I encountered a silent crash in the File component when asking it to read a Media file with spaces embedded in the file name.

(I had a Google Sheet with spaces in its name, and the spaces came down into its PC file name. I used the Windows rename (F2) operation to copy its file name when building the //Filename text block, not noticing that the AI2 Media file upload had silently removed spaces from the file name.)

A slightly better response to a missing file pops up when the file request lacks spaces:
image

I see several bugs here:

  • Silent crash (in Companion) when asked to read a Media file name with embedded spaces)
  • Lack of a File Error event block to catch file errors
  • Lack of a notfound parameter in the File Read block, like the TinyDB notfound value
  • outmoded File block tool tips encouraging retyping file names instead of using the helper blocks holding Media File nams


GilbertAndSullivan (1).aia (6.2 KB)

A revised File Read block doc should point out where to look for the file name helper blocks, and how to express their locations by setting file location contexts before calling file operations.

1 Like

Spaces are allowed in MS Windows filenames and paths. I think File Read could check for spaces, make a copy of the file, substituting the spaces with underscores, load the copy file and inform the User of what happened.

My immediate thought here is that it has something to do with how in many cases we internally represent files as URIs, in which case we will need to map the spaces to %20 encodings, or that we might be mapping the spaces and then not interpreting the percent encoding correctly before passing the path to the Java File class. I'll poke around and see what I can learn.

2 Likes