Skip to content

Change escaping function to build URL for searching #519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 30, 2022

Conversation

attakei
Copy link
Contributor

@attakei attakei commented May 27, 2022

Overview

Fix #518

Note

Search form submits raw-text to /search.php, but search.js build url with escaped text.
I think that it need not escape on JS too.

Ref: https://github.com/php/web-php/blob/master/include/header.inc#L127

js/search.js Outdated
@@ -360,7 +360,7 @@

dropdown.append(searchTemplate.render({
pattern: pattern,
url: "/search.php?pattern=" + escape(pattern)
url: "/search.php?pattern=" + pattern
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to escape, but we should not use the very old escape() function, but rather encodeURIComponent() instead.

Copy link
Contributor Author

@attakei attakei May 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for feedback.
I seem surely your feedback is right.

I will commit for using encodedURIComponent.
Can I commit as ammend and force push?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you can amend and force-push, but you can also add a new commit and push. We usually squash before merging anyway.

Copy link
Contributor Author

@attakei attakei May 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can also add a new commit and push

I selected it and push new commit, thank you

@attakei attakei changed the title Use raw-text from input to build URL for searching Change escaping function to build URL for searching May 27, 2022
@cmb69 cmb69 merged commit 438c8ba into php:master May 30, 2022
@cmb69
Copy link
Member

cmb69 commented May 30, 2022

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-ASCII text searching from search bar is not working rightly.
2 participants