johnfactotum / foliate

Read e-books in style
https://johnfactotum.github.io/foliate/
GNU General Public License v3.0
6.33k stars 289 forks source link

foliate could not open file #401

Open itisvishnu opened 4 years ago

itisvishnu commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

I installed it using snap.

itisvishnu commented 4 years ago

image

itisvishnu commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

fabiolimace commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

Great! Thanks again, @galgalesh!

m0n5t3r commented 4 years ago

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 commented 3 years ago

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.

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 commented 3 years ago

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

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 commented 2 years ago

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

bkosowski commented 2 years ago

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 commented 2 years ago

Hello @bkosowski , I had the same issue and the suggestion here finally resolved the problem for me: https://github.com/johnfactotum/foliate/issues/878#issuecomment-1118980706

SR-G commented 2 years ago

@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 commented 1 month ago

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