From 64874c773b7e1a58f484b18cd5aabcc350ed2cf8 Mon Sep 17 00:00:00 2001 From: infiinte-persistence Date: Mon, 1 Feb 2021 12:33:46 +0800 Subject: [PATCH] Search: Get `uris` with same query as `doSearch` ## Issue 2731: Searches with forward slashes returns no results ## Change The slash-removal came from (https://github.com/lbryio/lbry-redux/commit/0db20834f9ff99d3ba7acd8e4e8ebb5a41f7e7b4). Removing the 2 `replace(/\//, ' ')` from lbry-desktop fixes it, but this PR assumes the slash-removal is intentional to cover something else. So, we'll make the Search side do the same thing to match what's happening in `doSearch`. A little bit ugly, but there's already a comment about this in `makeSelectSearchUris`, so it'll probably get cleaned up in the future. --- ui/page/search/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/page/search/index.js b/ui/page/search/index.js index a896cbc72..d808e7a7f 100644 --- a/ui/page/search/index.js +++ b/ui/page/search/index.js @@ -16,7 +16,11 @@ import SearchPage from './view'; const select = (state, props) => { const showMature = makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state); const urlParams = new URLSearchParams(props.location.search); - const urlQuery = urlParams.get('q') || null; + let urlQuery = urlParams.get('q') || null; + if (urlQuery) { + urlQuery = urlQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' '); + } + const query = makeSelectQueryWithOptions( urlQuery, showMature === false ? { nsfw: false, isBackgroundSearch: false } : { isBackgroundSearch: false }