xdg-desktop-portal icon indicating copy to clipboard operation
xdg-desktop-portal copied to clipboard

file transfer does not handle folders

Open matthiasclasen opened this issue 2 years ago • 1 comments

This was reported here: https://gitlab.gnome.org/GNOME/gtk/-/issues/5348

The underlying issue is that AddFiles validates the fds by passing VALIDATE_FD_FILE_TYPE_REGULAR to validate_fd().

I think we should probably add an AddFolders method to the DBus interface.

matthiasclasen avatar Nov 17 '22 11:11 matthiasclasen

Alternatively, we could invent some way to validate the fds as 'either regular or folder'

matthiasclasen avatar Nov 17 '22 11:11 matthiasclasen

this function would be amazing!

CaptainMorgan12 avatar May 16 '23 17:05 CaptainMorgan12

Picking this up.

ebassi avatar May 17 '23 16:05 ebassi

I've played a bit with the idea of adding an AddFolders method, which is trivial on the portal side, but gets messy on the toolkit/application side. Aside from the duplication of code paths, it gets "funny" once you start accumulating file descriptors to send over the wire: it means you cannot interleave AddFiles and AddFolders calls, which is hard to detect on the portal side.

ebassi avatar May 18 '23 10:05 ebassi

An easier option is to use VALIDATE_FD_FILE_TYPE_ANY inside the file transfer portal, which will validate both files and directories; the document portal already supports this, so it should be fine.

Of course, easier said than done: the documents are added in bulk, and the document portal API still requires a split path for adding files and directories.

ebassi avatar May 18 '23 11:05 ebassi

See #1196

hfiguiere avatar Nov 16 '23 13:11 hfiguiere