Sublime-Text-2-Stackoverflow-Plugin icon indicating copy to clipboard operation
Sublime-Text-2-Stackoverflow-Plugin copied to clipboard

Search text is not URL-encoded (and, plus, hash and percent break the query)

Open dpc00 opened this issue 1 month ago • 0 comments

Claude reports: the search text is not URL-encoded, so characters like &, #, + and % change or cut the query.

SearchFor builds the address with 'https://stackoverflow.com/search?tab=relevance&q=' + text.replace(' ','%20'). Only spaces are escaped. For example the selection c++ std::vector & iterator becomes q=c++%20std::vector%20&%20iterator: + is read as a space and everything after the & is taken as a separate parameter, so the search is cut off. This is from reading the code; I did not look at the resulting address in the browser (Stack Overflow showed a human-verification page).

Fix: urllib.parse.quote(text) (or quote_plus).

dpc00 avatar Oct 19 '26 23:10 dpc00