summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTommaso Colella <tommasocolella95@gmail.com>2025-04-13 22:53:22 +0000
committerMarkus Heiser <markus.heiser@darmarIT.de>2025-04-17 10:24:05 +0200
commit99ad69450d3707fdb7e9626b6bbb7112c798fe2e (patch)
tree0471df4f7476693851c0bc440302299d699c50ff
parent087da66565dfea0f020172f47939e00fb1691def (diff)
[fix] Result type: remove rstrip "/" form url normalization
-rw-r--r--searx/result_types/_base.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/searx/result_types/_base.py b/searx/result_types/_base.py
index ce846c3cf..c098b1c3a 100644
--- a/searx/result_types/_base.py
+++ b/searx/result_types/_base.py
@@ -55,8 +55,7 @@ def _normalize_url_fields(result: Result | LegacyResult):
result.parsed_url = result.parsed_url._replace(
# if the result has no scheme, use http as default
scheme=result.parsed_url.scheme or "http",
- # normalize ``example.com/path/`` to ``example.com/path``
- path=result.parsed_url.path.rstrip("/"),
+ path=result.parsed_url.path,
)
result.url = result.parsed_url.geturl()
@@ -73,7 +72,7 @@ def _normalize_url_fields(result: Result | LegacyResult):
item["url"] = _url._replace(
scheme=_url.scheme or "http",
# netloc=_url.netloc.replace("www.", ""),
- path=_url.path.rstrip("/"),
+ path=_url.path,
).geturl()
infobox_id = getattr(result, "id", None)
@@ -82,7 +81,7 @@ def _normalize_url_fields(result: Result | LegacyResult):
result.id = _url._replace(
scheme=_url.scheme or "http",
# netloc=_url.netloc.replace("www.", ""),
- path=_url.path.rstrip("/"),
+ path=_url.path,
).geturl()
@@ -259,9 +258,6 @@ class Result(msgspec.Struct, kw_only=True):
``parse_url`` from field ``url``. The ``url`` field is initialized
with the resulting value in ``parse_url``, if ``url`` and
``parse_url`` are not equal.
-
- - ``example.com/path/`` and ``example.com/path`` are equivalent and are
- normalized to ``example.com/path``.
"""
_normalize_url_fields(self)