mirror of
https://github.com/benbusby/whoogle-search.git
synced 2026-04-25 12:15:50 +03:00
[PR #912] [MERGED] Fix: added a functionality to make sure escaped characters stay escaped. #1015
Labels
No labels
Fixed (Pending PR Merge)
Stale
bug
enhancement
enhancement
good first issue
help wanted
keep-open
needs more info
pull-request
question
theme
unfortunate
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/whoogle-search#1015
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/benbusby/whoogle-search/pull/912
Author: @ahmad-alkadri
Created: 12/23/2022
Status: ✅ Merged
Merged: 12/29/2022
Merged by: @benbusby
Base:
main← Head:fix/908-html-element-need-escape📝 Commits (1)
50da4b6Added a function to escape html text📊 Changes
2 files changed (+6 additions, -4 deletions)
View changed files
📝
app/routes.py(+4 -2)📝
app/utils/search.py(+2 -2)📄 Description
This PR is linked to the issue #908 which shows that, basically, Whoogle results render html characters unescaped. Here's a screenshot as referenced in the issue:
After checking, I found out that several points:
<div>content tag from the search results (getbody.textin search.py) are already escaped, with"<"and">"characters converted into"<"and">", respectivelygetbody.textthen passed through severalbsoupclass, the escaped tag characters became unescaped.To prevent this, I replaced
"<"and">"with"andlt;"and"andgt;", respectively. This way, when the 'response' object get loaded tobsoup(which happens several times throughout the process between search.py and routes.py),bsoupwill not unescape them. Finally, at the end, before theresponsesobject sent to therender_templateinroutes.py, I simply replaced the"andlt;"and"andgt;"back to"<"and">".Here's the screenshot from the search result on Whoogle following this fix:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.