whoozle / android-file-transfer-linux

Android File Transfer for Linux (and macOS!)
http://whoozle.github.io/android-file-transfer-linux/
GNU Lesser General Public License v2.1
1.43k stars 120 forks source link

Special characters in filenames are not escaped and fail to transfer #332

Open Mycohl opened 1 year ago

Mycohl commented 1 year ago

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.)

whoozle commented 1 year ago

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 commented 11 months ago

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