Use filtered query for map tab
The map tab should only ever pass the raw query (i.e. no "-site:..." strings), otherwise the maps page will return an error. Fixes #1048main
parent
a623210244
commit
a35b1dabbc
|
@ -13,7 +13,7 @@
|
||||||
},
|
},
|
||||||
"maps": {
|
"maps": {
|
||||||
"tbm": null,
|
"tbm": null,
|
||||||
"href": "https://maps.google.com/maps?q={query}",
|
"href": "https://maps.google.com/maps?q={map_query}",
|
||||||
"name": "Maps",
|
"name": "Maps",
|
||||||
"selected": false
|
"selected": false
|
||||||
},
|
},
|
||||||
|
|
|
@ -418,6 +418,10 @@ def get_tabs_content(tabs: dict,
|
||||||
Returns:
|
Returns:
|
||||||
dict: contains the name, the href and if the tab is selected or not
|
dict: contains the name, the href and if the tab is selected or not
|
||||||
"""
|
"""
|
||||||
|
map_query = full_query
|
||||||
|
if '-site:' in full_query:
|
||||||
|
block_idx = full_query.index('-site:')
|
||||||
|
map_query = map_query[:block_idx]
|
||||||
tabs = copy.deepcopy(tabs)
|
tabs = copy.deepcopy(tabs)
|
||||||
for tab_id, tab_content in tabs.items():
|
for tab_id, tab_content in tabs.items():
|
||||||
# update name to desired language
|
# update name to desired language
|
||||||
|
@ -433,7 +437,9 @@ def get_tabs_content(tabs: dict,
|
||||||
if preferences:
|
if preferences:
|
||||||
query = f"{query}&preferences={preferences}"
|
query = f"{query}&preferences={preferences}"
|
||||||
|
|
||||||
tab_content['href'] = tab_content['href'].format(query=query)
|
tab_content['href'] = tab_content['href'].format(
|
||||||
|
query=query,
|
||||||
|
map_query=map_query)
|
||||||
|
|
||||||
# update if selected tab (default all tab is selected)
|
# update if selected tab (default all tab is selected)
|
||||||
if tab_content['tbm'] == search_type:
|
if tab_content['tbm'] == search_type:
|
||||||
|
|
Loading…
Reference in New Issue