Libmtp error for filenames with quotation mark

Hi all,

on copying files via USB from a computer (GNU/Linux+Gnome DE) to my Fairphone 5, I recognized that copying files that have “?” in their filename causes the entire connection to crash.

Steps to reproduce:

  • On my openSUSE Laptop, I create a simple text file with some content, named “~/will_it_work?.txt”
  • I connect my Fairphone to the Laptop via a USB-C cable; in the menue on the phone, I select “USB controlled by this device” and “Use USB for file transfer”
  • The phone is now mounted and I can see it in Gnome-Files (ex. Nautilus)
  • I click “copy” on the text file, then navigate to “Fairphone 5 5G”/”Internal Storage”/”Documents”
  • I click “paste”

Now, first, this operation does not work, I get this error message:

libmtp error: Could not send object.

Secondly, this seems to cause the Fairphone to drop the connection and hang, at least when copying larger amounts of files (I was actually in the process of copying my music library, which can have all sorts of fun file names, and is larger than my test .txt file).

I guess this is a problem with MTP. MTP is bad.

When copying more than two files from/to your phone, I suggest anything, but MTP. Maybe install an FTP-Server on the phone.

I’m with bjoern here, copying my full music library to a phone via MTP has never worked for the exact same reasons you describe.

What I used to do in the past: my music is organized in folders artist name/album name. I manually copied them over in chunks, i.e. selecting like 5 artist folders and copying them over to the phone. If a file contained a “funny character” that stopped the transfer, I renamed the file on the PC + tried again. And then repeated that with the next bunch of artists until I was finished.

A very time consuming procedure. I guess nowadays I’d try to use syncthing and let it sync the music folder on the PC with my phone. Haven’t tried that out yet, because the files sit on an SD card (formatted as external storage) I just insert into a new phone instead of doing the copy process each time I get a new device.