Skip to content
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

Fixed search abandon anything after # character - #3779 #3826

Closed
wants to merge 1 commit into from

Conversation

knighthat
Copy link

Description

As described in #3779. If you search for a song title that contains # character, everything from that character will be dropped. As the result, the query only look for string before the #

What I found

I couldn't pin point the exact location where the problem occurred. But I narrowed down the scope and implemented a simple fix

The problem seems to be a string sanitization happens before the string is passed to param for query. As observed, line 383 of AppNavigation.kt yields both string with and without #.

Solution

This can be prevent by converting query string to URL-safe string (with special characters converted into their corresponding percent-encoded format) with the implementation of URLEncoder#encode(). For example, string CC#2 OST Arknights will be converted into CC%232+OST+Arknights

However, this creates another problem. The query string is now CC%232+OST+Arknights instead of what user input. When present this to user in SearchResultScreen.kt, the result is undesired.

To counter this effect, URLDecoder#decode() is implemented to convert URL-safe string to readable string.

Conclusion

The problem seems to go away when the implementation is introduced. But I think this is just a temporary solution until the root cause is found.

Songs with # or most special characters is showing up in search result

@fast4x
Copy link
Owner

fast4x commented Oct 1, 2024

Not better solution, temporary string will clean before send search...

@fast4x fast4x closed this Oct 1, 2024
@knighthat knighthat deleted the issue-3779 branch October 2, 2024 23:16
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.

2 participants