telescope-browser / telescope

browser for the small internet
https://telescope-browser.org
ISC License
47 stars 1 forks source link

Error Parsing URI in Multiple Cases #14

Closed valadect closed 8 months ago

valadect commented 8 months ago

Version: 0.8.1 System: Fedora Asahi Remix

Multiple Can't parse the URI errors in different circumstances. Here's two to replicate.

Case 1

  1. Visit Veronica-2 and enter a search term with >30 results.
  2. Navigate at the bottom of the page with Next 30 matches
  3. Can't parse the URI

Case 2

  1. Visit gopher://gopherpedia.com
  2. Browse to any link under "Featured Content" heading
  3. Can't parse the URI

Interestingly, at least in the second example, if you quit telescope with q at the error page, then re-run telescope, the page loads fine when restoring the tabs from your previous session.

omar-polo commented 8 months ago

Nice find, thanks for reporting.

So, taking an example from gopherpedia.com, the lines where telescope fails to follow the link are like:

0February 19, 2024: Teloschistes flavicans  /Teloschistes flavicans gopherpedia.com 70

that is, they have spaces in the path (or other "special" characters)

Here Teloschistes flavicans is the path which telescope wants it to be URL-encoded, which is wrong, since they don't have to be. I'll fix the gopher parser to properly convert gophermaps lines to URLs.

omar-polo commented 8 months ago

62c0f697ddc7396384280f2f8bac7a092700f1ba should fix this issue. Telescope now properly url-encodes the path of gopher link lines and urldecodes it before sending the selector. The urlencode / urldecode dance should be an identity, so the selector sent to the server should be exactly the same path extracted from the page.

This has also made me realize that telescope could save the search string in the query part of the URL for history purposes. I'll look into it too.

omar-polo commented 8 months ago

0.9 is available and includes this fix, so I'm going to close this issue. Feel free to reopen if there are some cases where it still fails. Thanks!

P.S.: I'm going to open a different issue for saving the search string in the query part for history purposes.