psst icon indicating copy to clipboard operation
psst copied to clipboard

Add URL encoding to search

Open SO9010 opened this issue 6 months ago • 6 comments

Currently, we are just using a placeholder to replace the spaces in a query but it needs to changed to use URL encoding.

SO9010 avatar Jun 09 '25 18:06 SO9010

Hmm, do you mean that this line needs to be improved upon, or are you referring to something else?

https://github.com/jpochyla/psst/blob/0e9c8d0283ced2c453aafa836be16de9fd51e48c/psst-gui/src/webapi/client.rs#L1351

arch-btw avatar Jun 11 '25 17:06 arch-btw

Yeah that line!

SO9010 avatar Jun 11 '25 20:06 SO9010

Sorry for probably being slow, but why does it need improving.

secondlnl avatar Jun 12 '25 10:06 secondlnl

I believe that if we don't do url encoding then we will get errors from illegal characters in urls. Which is why we needed to replace the spaces with %20. But I believe that we also need to do things like ':'.

But it was just a quick submitted issue that I didn't 100 percent check.

So if you would like to you could check if a query with something like : or any other not allowed chars in a url please feel free to do so. If not I'll be able to test soon :)

SO9010 avatar Jun 12 '25 10:06 SO9010

Edit: There exists a crate called urlencoding, link to docs.rs, rust discourse discussion about urlencoding in general Tested: Invalid uri " < > Status 400 # ` \ | % & { } + ^ ; € The plus symbol is okay as long as there's another character, errors only when alone. Others tested: ! @ £ $ ¤ / ( ) [ ] = ? ´ ¨ ~ * ' : . , _ - µ

secondlnl avatar Jun 12 '25 11:06 secondlnl

Wow thank you very much! For the detailed test! And that crate sounds good to me!

SO9010 avatar Jun 12 '25 12:06 SO9010