flathub / net.ankiweb.Anki

https://flathub.org/apps/details/net.ankiweb.Anki
20 stars 13 forks source link

Can't access file storage #24

Closed 12people closed 3 months ago

12people commented 5 years ago

When I install the flathub version of Anki and try to import a file, it gives me access only to a virtual 4 GB drive, not to my actual 1 TB drive with the files I want to import.

Using Ubuntu 19.04. What can I do?

jurf commented 5 years ago

This shouldn’t be happening, file access is done by the portal. Have you completed the steps in https://flatpak.org/setup/Ubuntu/?

12people commented 5 years ago

@jurf Yup, to the letter.

I initially thought it was a settings matter, but the Application settings panel in GNOME lists only network access as a built-in permission for the Anki app and tells me that the permissions cannot be changed.

jurf commented 5 years ago

Well, I cannot reproduce this on my system, I can access my external drives just fine. Is there anything interesting in the logs?

12people commented 5 years ago

@jurf Here are the logs:

13:34:20 systemd: flatpak-net.ankiweb.Anki-27466.scope: Succeeded.
13:34:20 gjs: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
13:34:20 systemd: gnome-terminal-server.service: Succeeded.
13:34:20 gnome-shell: qt: Qt: Session management error: None of the authentication protocols specified are supported
13:34:16 python3: failed to commit changes to dconf: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: org.freedesktop.DBus.Error.ServiceUnknown
13:34:14 gnome-shell: Window manager warning: Buggy client sent a _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x7400007
13:34:12 gjs: AT-SPI: Unable to open bus connection: Failed to connect to socket /run/user/1000/at-spi2-LV181Z/socket: No such file or directory
13:34:12 python3: Failed to load module "canberra-gtk-module"
13:34:11 systemd: Started flatpak-net.ankiweb.Anki-27466.scope.
njam commented 3 years ago

I've noticed that for the "Import" operation my home directory appears empty. My workaround is to allow full access to the host filesystem as described in the ticket about "Export": https://github.com/flathub/net.ankiweb.Anki/issues/26#issuecomment-504334187

flatpak override --user net.ankiweb.Anki --filesystem=host
novahahn commented 2 years ago

Same issue here (Flatpak 1.10.2, Anki 2.1.44). Anki also shows the plain Qt file picker rather than the Plasma one, which I think would be expected since I run Anki under Plasma.

12people commented 2 years ago

The solution here might be to use the official (and recommended) Flatpak portals — see xdg-desktop-portal for more info.

That should not only solve this issue, but also increase the security of the Flatpak app.

12people commented 2 years ago

According to the official Flatpak documentation, using QFileDialog (but NOT QFileDialog::DontUseNativeDialog) should give you access to file portals for free. In Qt, this apparently only works for browsing for files, not for folders.

It would at least be a start.

novahahn commented 2 years ago

Anki does use QFileDialog. But the flatpak currently uses the upstream binaries, which bundle their own Qt. Perhaps portals only work if you use the Flatpak-provided Qt.

njam commented 2 years ago

I think this has been fixed by Anki. I can import/export decks from the local filesystem by default.

(Anki ⁨2.1.49)

ingemarberg commented 2 years ago

I've tested this in Anki 2.1.50 and I can import and export decks as expected.

Wemmy0 commented 1 year ago

Still broken for me I'm installing the AUR version instead (but needs support for the new version of python)

rayes0 commented 3 months ago

Closing as this is an old issue, I cannot reproduce this, and nothing can be done to fix this in the flatpak.

This should work correctly provided that you have the correct xdg-desktop-portal-* package installed, and that it is running. If you do not want to set up the portal, then the other solution would be allowing filesystem=host as suggested earlier.