android-file-transfer-linux icon indicating copy to clipboard operation
android-file-transfer-linux copied to clipboard

Special characters in filenames are not escaped and fail to transfer

Open Mycohl opened this issue 1 year ago • 2 comments

Steps to repro:

  1. Create text file with a name such as "Any News?.txt", "More|Power.txt", "Cool*Party.txt", or "Double "Quotes".txt"
  2. Attempt to upload file to android device

Result: Sometimes file silently fails to copy. Sometimes UI hangs, especially when copying multiple files.

Expected behavior: Files with ?, |, *, or " in the name will upload to device just like every other file

(To be fair, my distro's version of gvfs-mtp also appears to have this bug.)

Mycohl avatar Jul 07 '23 04:07 Mycohl

I don't think it's possible to upload such files, as PTP does not say anything about object names (from PTP perspective they are not files, but rather just arbitrary names), but I double check the spec. And also investigate why UI freezes. :grimacing: Nice find, thanks!

whoozle avatar Jul 12 '23 11:07 whoozle

Found this https://stackoverflow.com/questions/2679699/what-characters-allowed-in-file-names-on-android

I wonder what's the best behaviour for those. I don't want to replace with something static, like space, maybe u<utf16 in hex> or x<ascii code in hex> would do? for instance ? would be x3f

whoozle avatar Jul 30 '23 14:07 whoozle