Corewala / Buran

Gemini browser for Android
GNU General Public License v3.0
107 stars 10 forks source link

Links getting partially URL decoded and mangled before being sent #11

Closed acidus99 closed 2 years ago

acidus99 commented 2 years ago

Noticing a problem when clicking on links that have other links URL encoded in them.

Here is a page from Gemipedia. It contains links to images.

gemini://gemi.dev/cgi-bin/wp.cgi/images?Moon

The Urls in the links contain an HTTP URL that is passed via the query string. Looking at the Gemtext, you can see a properly encoded URL:

# Image Gallery: Moon
[...snip...]

=> /cgi-bin/wp.cgi/media/media.jpg?https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fthumb%2Fe%2Fe1%2FFullMoon2010.jpg%2F440px-FullMoon2010.jpg The near side of the Moon (north is at top)

When clicking with this link with Buran v1.7, this is the incoming URL that I see in my logs:

gemini://gemi.dev/cgi-bin/wp.cgi/media/media.jpg?https%3A/upload.wikimedia.org/wikipedia/commons/thumb/e/e1/FullMoon2010.jpg/440px-FullMoon2010.jpg

Notice that the / characters in the query string are not sent URL encoded. It also appears that the // in the https:// has be reduced down to a single /.

When I make this request with Lagrange or other clients, I see the correct URL requested in my logs:

gemini://gemi.dev/cgi-bin/wp.cgi/media/media.jpg?https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fthumb%2Fe%2Fe1%2FFullMoon2010.jpg%2F440px-FullMoon2010.jpg

The biggest issue here is changing the encoded // to a single /, This means my server-side code gets an invalid URL from the query string, and I cannot fetch the needed image

Corewala commented 2 years ago

Yeah I fixed this a few commits ago. It should be working in the next update :)

acidus99 commented 2 years ago

awesome. When is the next release?