Trailing slash ignored by GFile when using custom URI sheme

I’m trying to add OPDS support in Foliate. One feature is that you can open OPDS feeds from opds: links. For example, Feedbooks has such a link on their website.

The problem is that, when opening links like opds://m.gutenberg.org/ebooks.opds/, the trailing slash is ignored:

gjs> var file = imports.gi.Gio.File.new_for_uri('opds://example.com/foo.bar/')
gjs> file.get_uri()
"opds://example.com/foo.bar"

Gutenberg’s site requires the trailing slash; without it, it will return “path not found”.

On the other hand, when using HTTP, the trailing slash works as expected:

gjs> var file = imports.gi.Gio.File.new_for_uri('https://example.com/foo.bar/')
gjs> file.get_uri()
"https://example.com/foo.bar/"

Is this a GLib bug? Is there a way to work around this?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.