ladybird icon indicating copy to clipboard operation
ladybird copied to clipboard

LibWebView: Improved url sanitizing logic

Open ashp0 opened this issue 11 months ago • 3 comments

When you search a simple word such as "hello" on the browser, it would assume it is a URL and say "cannot find url" when in fact it was supposed to redirect me to the default search engine.

I fixed this by simply checking whether or not the domain has a period. (White spaces are handled automatically)

I also changed the function so the default fallback would be format_search_engine rather than a url. I also think someone should fix the compute_url function in the LibURL file.

But yeah that's all, and it's my first commit here!!

ashp0 avatar Dec 08 '24 14:12 ashp0

This doesn't seem correct because if I try to enter a hostname that is setup in my hosts file (e.g. http://testing) then it redirects to a search engine. I agree that it doesn't handle single word queries well currently, but it'll probably take some more thought to get right. I think the if block above this one is the culprit for single standalone words having "https://" prepended.

rgret-dev avatar Dec 08 '24 14:12 rgret-dev

Okay done! I believe that the issue would be fixed now.

ashp0 avatar Dec 08 '24 20:12 ashp0

Your new changes don't fix single-word inputs. Additionally, you'll want to rewrite your git history (i.e. a single commit per fix/feature) before pushing and make sure the messages are in an imperative mood.

See CONTRIBUTING.md and GettingStartedContributing.md

rgret-dev avatar Dec 08 '24 20:12 rgret-dev

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

github-actions[bot] avatar Dec 30 '24 02:12 github-actions[bot]

This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!

github-actions[bot] avatar Jan 06 '25 02:01 github-actions[bot]