foreseen

A text-based gemini browser with prefetching
git clone git://git.laack.co/foreseen.git
Log | Files | Refs | README | LICENSE

commit 836f272faf498aaea4db21a05094270bc56a5e0e
parent 63e2d68eb6435b8f18d4bba59488701734a679ed
Author: Andrew Laack <andrew@laack.co>
Date:   Fri,  9 Oct 2026 02:12:51 -0500

Fixed bug with query parameters being appended

Co-authored-by: Vim

Diffstat:
Mdocs/TODO | 1+
Msrc/browser.cpp | 1-
Msrc/link.cpp | 6+++++-
3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/docs/TODO b/docs/TODO @@ -13,3 +13,4 @@ - move shared.hpp -> config.hpp - refactor non-runtime configurable values to be set in hpp file - inject these into about://newtab +- make sure keybings screen is consistent diff --git a/src/browser.cpp b/src/browser.cpp @@ -13,7 +13,6 @@ #include <utility> #include <vector> -#include "../include/errors.hpp" #include "../include/gemini-client.hpp" #include "../include/identity-manager.hpp" #include "../include/shared.hpp" diff --git a/src/link.cpp b/src/link.cpp @@ -71,9 +71,13 @@ uri Link::parseDestination(std::string destination, std::optional<uri> prior) { if (destination.find(":") == std::string::npos || destination[0] == '?') { if (prior != std::nullopt) { // query parameter special casing + // strip old before new. if (destination.substr(0, 1) == "?") { std::string encoded = urlEncode(destination.substr(1)); - return uri{prior.value().to_string() + "?" + encoded}; + std::string base = prior.value().to_string(); + base = base.substr(0, base.find('#')); + base = base.substr(0, base.find('?')); + return uri{base + "?" + encoded}; } std::string base = prior->get_scheme() + "://" + prior->get_host();