Sublime-Text-2-Stackoverflow-Plugin
Sublime-Text-2-Stackoverflow-Plugin copied to clipboard
Search text is not URL-encoded (and, plus, hash and percent break the query)
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).