Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure the file chooser only sends file: uris back #213

Closed
matthiasclasen opened this issue Aug 27, 2018 · 7 comments
Closed

ensure the file chooser only sends file: uris back #213

matthiasclasen opened this issue Aug 27, 2018 · 7 comments
Labels
backend specific This is an issue in implementations enhancement portal: file chooser File Chooser portal

Comments

@matthiasclasen
Copy link
Contributor

So far, we've used GIO_USE_VFS=local to guarantee this, but we do want to let the user access gvfs. That means that we need to translate non-file uris to their local (fuse) equivalents, since we can't rely on things like trash: or recent: to work inside the sandbox.

@matthiasclasen
Copy link
Contributor Author

A quick test shows that the file chooser already returns file: uris, at least for recent files.

@hadess
Copy link
Contributor

hadess commented Aug 29, 2018

This little song and dance gets a file:/// URI for most gvfs backends:
https://gitlab.gnome.org/GNOME/totem/blob/master/src/backend/bacon-video-widget.c#L4045
get_target_uri() is the interesting one.

@Be-ing
Copy link

Be-ing commented Jan 18, 2022

I am stumbling over this as well. I am working on rfd, a cross platform Rust library abstracting over file dialogs on different OSes. On macOS and Windows, the file dialogs only return file paths. But the XDG Desktop Portal allows the file dialog to return arbitrary URIs. I can easily strip off the file:// prefix, but if the user picks something with a different prefix, the best this cross platform abstraction can do is act as if no file was picked or ask the user to pick again.

@lissyx
Copy link

lissyx commented Jun 13, 2022

Until this issue is fixed, UX should not show anything to the user: https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/48

sergio-costas added a commit to sergio-costas/xdg-desktop-portal that referenced this issue Jun 15, 2022
By default, xdg-desktop-portal runs with "GIO_USE_VFS=local"
to guarantee that it only sends local URIs, but that also
means that the user can't access files that are mounted locally
using GVfs.

This patch filters all the URIs sent and replaces, wherever
possible, any remote URI (like sftp://, smb://...) with the
corresponding one in the local filesystem created by GVfs.

Fix flatpak#213
sergio-costas added a commit to sergio-costas/xdg-desktop-portal that referenced this issue Jun 22, 2022
By default, xdg-desktop-portal runs with "GIO_USE_VFS=local"
to guarantee that it only sends local URIs, but that also
means that the user can't access files that are mounted locally
using GVfs.

This patch filters all the URIs sent and replaces, wherever
possible, any remote URI (like sftp://, smb://...) with the
corresponding one in the local filesystem created by GVfs.

Fix flatpak#213
sergio-costas added a commit to sergio-costas/xdg-desktop-portal that referenced this issue Jun 27, 2022
By default, xdg-desktop-portal runs with "GIO_USE_VFS=local"
to guarantee that it only sends local URIs, but that also
means that the user can't access files that are mounted locally
using GVfs.

This patch filters all the URIs sent and replaces, wherever
possible, any remote URI (like sftp://, smb://...) with the
corresponding one in the local filesystem created by GVfs.

Fix flatpak#213
sergio-costas added a commit to sergio-costas/xdg-desktop-portal that referenced this issue Jun 27, 2022
By default, xdg-desktop-portal runs with "GIO_USE_VFS=local" to
guarantee that it only sends local URIs, but that also means
that the user can't access files that are mounted locally using
GVfs.

This patch filters all the URIs sent and replaces, wherever
possible, any remote URI (like sftp://, smb://...) with the
corresponding one in the local filesystem created by GVfs.

Fix flatpak#213

Fix flatpak#820

Don't use Gvfs

Remove the need for Gvfs when accessing files mounted with
gvfsd-fuse.
barthalion pushed a commit to sergio-costas/xdg-desktop-portal that referenced this issue Jun 27, 2022
By default, xdg-desktop-portal runs with "GIO_USE_VFS=local" to
guarantee that it only sends local URIs, but that also means
that the user can't access files that are mounted locally using
GVfs.

This patch filters all the URIs sent and replaces, wherever
possible, any remote URI (like sftp://, smb://...) with the
corresponding one in the local filesystem created by GVfs.

Fix flatpak#213

Fix flatpak#820

Don't use Gvfs

Remove the need for Gvfs when accessing files mounted with
gvfsd-fuse.
sergio-costas added a commit to sergio-costas/xdg-desktop-portal that referenced this issue Jun 27, 2022
By default, xdg-desktop-portal runs with "GIO_USE_VFS=local" to
guarantee that it only sends local URIs, but that also means
that the user can't access files that are mounted locally using
GVfs.

This patch filters all the URIs sent and replaces, wherever
possible, any remote URI (like sftp://, smb://...) with the
corresponding one in the local filesystem created by GVfs.

Fix flatpak#213

Fix flatpak#820

Don't use Gvfs

Remove the need for Gvfs when accessing files mounted with
gvfsd-fuse.
sergio-costas added a commit to sergio-costas/xdg-desktop-portal that referenced this issue Jun 28, 2022
By default, xdg-desktop-portal runs with "GIO_USE_VFS=local" to
guarantee that it only sends local URIs, but that also means
that the user can't access files that are mounted locally using
GVfs.

This patch filters all the URIs sent and replaces, wherever
possible, any remote URI (like sftp://, smb://...) with the
corresponding one in the local filesystem created by GVfs.

Fix flatpak#213

Fix flatpak#820

Don't use Gvfs

Remove the need for Gvfs when accessing files mounted with
gvfsd-fuse.
sergio-costas added a commit to sergio-costas/xdg-desktop-portal that referenced this issue Jul 27, 2022
By default, xdg-desktop-portal runs with "GIO_USE_VFS=local" to
guarantee that it only sends local URIs, but that also means
that the user can't access files that are mounted locally using
GVfs.

This patch filters all the URIs sent and replaces, wherever
possible, any remote URI (like sftp://, smb://...) with the
corresponding one in the local filesystem created by GVfs.

Fix flatpak#213

Fix flatpak#820

Don't use Gvfs

Remove the need for Gvfs when accessing files mounted with
gvfsd-fuse.
@sergio-costas
Copy link

proposed patch in xdg-desktop-portal-gnome that fixes this: https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/merge_requests/67

@GeorgesStavracas GeorgesStavracas moved this to Needs Triage in Triage Oct 2, 2023
@GeorgesStavracas GeorgesStavracas added portal: file chooser File Chooser portal enhancement backend specific This is an issue in implementations labels Oct 5, 2023
@GeorgesStavracas GeorgesStavracas moved this from Needs Triage to Triaged in Triage Oct 5, 2023
GeorgesStavracas added a commit to GeorgesStavracas/xdg-desktop-portal that referenced this issue Oct 28, 2023
To ensure the documented behaviour, ignore URIs without the file://
scheme.

Closes: flatpak#213
GeorgesStavracas added a commit to GeorgesStavracas/xdg-desktop-portal that referenced this issue Oct 28, 2023
To ensure the documented behaviour, ignore URIs without the file://
scheme.

Closes: flatpak#213
GeorgesStavracas added a commit to GeorgesStavracas/xdg-desktop-portal that referenced this issue Oct 28, 2023
To ensure the documented behaviour, ignore URIs without the file://
scheme.

Closes: flatpak#213
github-merge-queue bot pushed a commit that referenced this issue Oct 30, 2023
To ensure the documented behaviour, ignore URIs without the file://
scheme.

Closes: #213
@GeorgesStavracas
Copy link
Member

This has been pushed into a documentation change. Backends are responsible for returning only file:// URIs.

@sergio-costas
Copy link

Thanks!

gnomesysadmins pushed a commit to GNOME/xdg-desktop-portal-gnome that referenced this issue Nov 19, 2023
Several people complain that they can't save files in remote
drives (like a SMB mount) from containerized applications (like
Firefox). After doing several tests, I found that it worked
fine when using xdg-desktop-portal-gtk, but not when using
xdg-desktop-portal-gnome.

The reason seems to be that xdg-desktop-portal-gtk translates
the smb:// URIs (and other remote URIs like sftp://) into
locally accessible file:// URIs (thanks to the FUSE backends
available with Gvfs), but xdg-desktop-portal-gnome doesn't do
that.

This patch fixes this by checking each URI obtained from the
GtkFileChooser dialog, and if it isn't a "file://" one, it
tries to translate it into its FUSE local URI.

Also ensure that a trash:/// or a recent:/// URI is transformed
into a local one.

Fix https://bugzilla.mozilla.org/show_bug.cgi?id=1773624
Fix flatpak/xdg-desktop-portal#213
Fix flatpak/xdg-desktop-portal#820
gnomesysadmins pushed a commit to GNOME/xdg-desktop-portal-gnome that referenced this issue Nov 21, 2023
Several people complain that they can't save files in remote
drives (like a SMB mount) from containerized applications (like
Firefox). After doing several tests, I found that it worked
fine when using xdg-desktop-portal-gtk, but not when using
xdg-desktop-portal-gnome.

The reason seems to be that xdg-desktop-portal-gtk translates
the smb:// URIs (and other remote URIs like sftp://) into
locally accessible file:// URIs (thanks to the FUSE backends
available with Gvfs), but xdg-desktop-portal-gnome doesn't do
that.

This patch fixes this by checking each URI obtained from the
GtkFileChooser dialog, and if it isn't a "file://" one, it
tries to translate it into its FUSE local URI.

Also ensure that a trash:/// or a recent:/// URI is transformed
into a local one.

Fix https://bugzilla.mozilla.org/show_bug.cgi?id=1773624
Fix flatpak/xdg-desktop-portal#213
Fix flatpak/xdg-desktop-portal#820


(cherry picked from commit 8acf01a)
agx pushed a commit to agx/xdg-desktop-portal that referenced this issue Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend specific This is an issue in implementations enhancement portal: file chooser File Chooser portal
Projects
No open projects
Status: Triaged
6 participants