Should use G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME as filename instead of ID when copying from GVFS mounted file systems
Submitted by Myk
Assigned to Xfce Bug Triage
Situation - Using Gnome-Accounts and GVFS to mount a Google Drive. On copying a file from the remote GVFS filesystem, the filenames are turned into incomprehensible strings, taken from Google's internal ID used to distinguish identically-named files.
Distribution : Manjaro Thunar: 1.8.4git-771dc2 gnome-control-center 3.32.1-1 gvfs 1.40.1-2 gvfs-google 1.40.1-2 gvfs-goa 1.40.1-2 gnome-online-accounts 3.32.0-1
- install gnome-control-centre, google-gvfs and gnome-online-accounts,
sh -c "XDG_CURRENT_DESKTOP=GNOME gnome-control-center"to add a Google account
- Mount Google drive in Thunar and open it
- Copy a file from Google Drive to a local file system
- Notice the name of the copied file is nothing like the name of the file as correctly shown in Thunar, eg, copying a file named "my.vimrc" to my home directory resulted in a file named "19K-XUZfXa3V_BZEK
All GFiles have a basename (get with g_file_get_basename()). These names are byte strings that are used to identify the file on the filesystem (relative to its parent directory) and there is no guarantees that they have any particular charset encoding or even make any sense at all. If you want to use filenames in a user interface you should use the display name that you can get by requesting the G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with g_file_query_info(). This is guaranteed to be in UTF-8 and can be used in a user interface. But always store the real basename or the GFile to use to actually access the file, because there is no way to go from a display name to the actual name.
Clearly, Thunar is accessing this G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME when displaying files in the UI, but on copying, it is instead using the byte string instead of ensuring that the copied file ends up represented to the user the same way.