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

foliate could not open file #401

Open
itisvishnu opened this issue May 29, 2020 · 23 comments
Open

foliate could not open file #401

itisvishnu opened this issue May 29, 2020 · 23 comments
Labels
bug Something isn't working snap

Comments

@itisvishnu
Copy link

i have installed both ubuntu 20 and windows10 on my laptop.
i have some some epub files stored on windows drive(NTFS) and i am able access all those files easily by mounting those drives.
I open those epub files on foliate, it says '' could not open file, empty response''
But if I copy those epub files on ubuntu drive, then they open easily.

@johnfactotum johnfactotum added bug Something isn't working need info More info needed to reproduce or fix labels May 29, 2020
@johnfactotum
Copy link
Owner

Hmm. I don't have a dual boot setup, but I can open files from external NTFS drives fine.

"Empty Response" is also strange. I think that's usually the error message when the request is denied for being cross-origin. But opening files from mounted drives should behave the same as other local files. Are you using Snap, Flatpak, or .deb/PPA?

@itisvishnu
Copy link
Author

I installed it using snap.

@johnfactotum johnfactotum added snap and removed need info More info needed to reproduce or fix labels May 29, 2020
@itisvishnu
Copy link
Author

image

@itisvishnu
Copy link
Author

I understand now why you asked installation method.
I removed it and it and installed it using PPA and it worked correctly.
I removed that and installed again using snap , again same issue.
So it is confirmed that issue is with snap version only( latest/stable 2.2.0 published today ie 29 may)

@itisvishnu
Copy link
Author

Also when I click on the open another file ... button above in picture, it it doesn't list any of the ntfs drives in opened window.

@prathapkotagiri
Copy link

Thank you,

I had faced the same issue when installed using SNAP. I removed it and installed using PPA.
Not I am able to open books saved at other locations than at home.

Regards....

@merlijn-sebrechts
Copy link
Contributor

merlijn-sebrechts commented Jul 11, 2020

Note: I've requested removable-media be auto-connected to Foliate. This should solve many of these issues. https://forum.snapcraft.io/t/auto-connect-removable-media/18653

@merlijn-sebrechts
Copy link
Contributor

merlijn-sebrechts commented Jul 11, 2020

@johnfactotum This could be solved for all cases by using the FileChooser portal. However, Foliate does not seem to be using that, even though GTK_USE_PORTALS is set to 1.

According to the docs, the FileChooser portal should work automatically when you use GtkFileChooserNative or GtkFileChooserButton. Do you know if you are using these?

Note: an easy way to check if you're using the portal file chooser in the snap is to click on "home". With the portal, this will point to the real user's home. With the regular file chooser, this will point to the snap-specific home folder.

@johnfactotum
Copy link
Owner

I'm using GtkFileChooserNative everywhere, and it does use the portal in Flatpak. But it doesn't seem to be using the portal when run as a Snap.

@fabiolimace
Copy link

I installed foliate today via SNAP after seeing a tweet recommending it. It's an excellent alternative to Calibre!

But I'm facing the same problem. My Calibre library is at another mounting point. When I try to open a file from that mounting point the error "Empty Response" occurs.

Despite this small problem, I will continue to use the program in my PC.

Thank you so much!

@merlijn-sebrechts
Copy link
Contributor

@fabiolimace can you access those files after you run snap connect foliate:removable-media?

@fabiolimace
Copy link

fabiolimace commented Jul 16, 2020

@galgalesh , it works! Thank you!

I know nothing about snaps. Can this connection be made automatically when fist installed?

Should we use the option "--classic" when installing via command line for full access?

I just read some pages of the documentation:

https://snapcraft.io/docs/interface-management
https://snapcraft.io/docs/supported-interfaces
https://snapcraft.io/docs/permission-requests

@merlijn-sebrechts
Copy link
Contributor

Yes, I have put in a request to make this automatically connected: https://forum.snapcraft.io/t/auto-connect-removable-media/18653

Normally, this should not be required. Normally, the OS should grant Foliate access to any files the user chooses, by using the FileChooser portal, but that does not work right now for the Foliate snap and I need to further investigate why. In the meantime the auto-connection should solve most users problems.

You should not install Foliate using --classic because that will not work. The snap publisher decides whether to use classic or not, and users can only run the snap using the confinement that the publisher chose. The Foliate snap is designed to run under strict confinement and it's designed to get access to the filesystem using the interfaces. It will not be able to run under classic confinement. snap connect foliate:removable-media is the right approach here. You can also enable those permissions in the software store (permissions button on the page for Foliate) and in the "settings" app. However, those GUI options are not supported on each distro, so your best bet is currently to do it via the command line.

This permissions system is a bit complicated for users currently, but a bunch of people are working hard to solve those issues. The "XDG desktop portals" will solve many issues and the Snap developers are working on additional ways to make the app ask the user for additional permissions when the app needs it. However that needs some more time before it will be available.

@merlijn-sebrechts
Copy link
Contributor

Note: removable-media auto-connection has been granted. All users should now be able to open files on USB sticks and external hard drives by default.

@fabiolimace
Copy link

Great! Thanks again, @galgalesh!

@m0n5t3r
Copy link

m0n5t3r commented Aug 26, 2020

for what it's worth, the latest deb (2.4.2) does the same with network locations / sftp, while the snap version seems to work just fine (came across this after I came across a bunch of epubs atril wouldn't open)

@ProfYaffle
Copy link

I don't really like riding on the back of previous issues, especially ones that have been around for a while - but I suspect this is still current, and just bit me, so I'll offer it up anyway. It starts to look like a feature of snaps.

2.5.0 installed as a snap. ZFS filesystem, zpool vol0 mounted below root as... well, /vol0. Kernel 5.4.0-52 on Xubuntu 20.04.1. System partition is ext4.

  • Double-click on an ebook on the ZFS partitions, "file not found".
  • Right-click, "Open with...", "file not found".
  • Try opening from within Foliate, and navigating to the mount points shows... nothing, no visibility of anything other than the "main" filesystem. I can't even see the mount point.

image

snap connect foliate:removable-media didn't make any difference (maybe there's an equivalent for mounted, but not removable, filesystems, but I can't see why there would be? I couldn't find anything if there is).

Uninstalled the snap, and installed the 2.5.0 .deb via PPA from https://launchpad.net/~apandada1/+archive/ubuntu/foliate.

All now works as expected: any file on the NFS partitions, opened any way, open directly into the application. Similarly, navigation across the internal filesystems now works properly as well.

Reversed the process - uninstalled using apt, reinstalled using snap install - and the problem comes straight back. I suspect snap filesystem sandboxing may simply prevent traversing to the ZFS partition, but...

@SR-G
Copy link

SR-G commented May 8, 2021

I have roughly the same symptoms (probably quite related) :

  • Foliate is installed on an up-to-date Archlinux systems, and installed through the "community" package "community/foliate 2.6.3-1"
  • Everything is working fine with local files
  • But if i copy these fully working .epub on a SAMBA share (located on my NAS), then i have that exact same error (note : i use thunar (= nothing is mounted against the local filesystem), in which i just open the network share with the "smb://<remote_ip>/ebooks/" thunar link, then i just double-click on the .epub file (.epub extension is associated with Foliate)).

image

It is worth mentionning that in that exact same configuration, FBReader (for example) is fully able to open the files. Also if i copy the files back in local, i can open them with Foliate (as described by other users).

@pavdigital
Copy link

Same, books on network shares don't open via dd-apt-repository ppa:apandada1/foliate repository however do via snap

@bkosowski
Copy link

Here's what I'm getting when running through terminal:

(com.github.johnfactotum.Foliate:45009): Gjs-WARNING **: 21:39:26.698: JS ERROR: Error: Empty Response
_init/<@resource:///com/github/johnfactotum/Foliate/js/epubView.js:623:57
_handleAction@resource:///com/github/johnfactotum/Foliate/js/epubView.js:886:22
_init/<@resource:///com/github/johnfactotum/Foliate/js/epubView.js:617:18
main@resource:///com/github/johnfactotum/Foliate/js/main.js:478:24
run@resource:///org/gnome/gjs/modules/script/package.js:206:19
@/usr/bin/foliate:9:17

I have foliate-2.6.4-1 installed on Manjaro Linux (based on Arch). It's not a snap or anything like that. Just an app installed on my system.

Unfortunately, I cannot open any epub books, no matter where they are. And yes, this includes local files (in my home directory).

@mxschumacher
Copy link

Hello @bkosowski , I had the same issue and the suggestion here finally resolved the problem for me: #878 (comment)

@SR-G
Copy link

SR-G commented Jun 1, 2022

@mxschumacher good to know but this does NOT solve the "could not open file" issue when opening files from a samba share (i just tested it - deleted the mime cache folder - and it still fails in the same way than before). So maybe in the end there are very different issues with same kind of symptoms.

@nayomnik
Copy link

The only what helped me . Try these first:
flatpak install flathub com.github.johnfactotum.Foliate
and then run the app:
flatpak run com.github.johnfactotum.Foliate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working snap
Projects
None yet
Development

No branches or pull requests