Redirector icon indicating copy to clipboard operation
Redirector copied to clipboard

URL Decode "+"

Open ariel-co opened this issue 4 years ago • 3 comments

I was trying to work around a bug where a website doesn't decode "+" as a word delimiter in searches:

Example: https://jisho.org/search/black+tea Include: ^(?:https?://)jisho.org/search/(.*) Redirect to: https://jisho.org/search/$1 Process matches: URL Decode Expected: https://jisho.org/search/black%20tea Example result: https://jisho.org/search/black+tea

I think it's just a matter of appending .replace("+"." ") in redirect.js:278,280

		if (this.processMatches == 'urlDecode') {
			repl = unescape(repl.replace("+"." "));
		} else if (this.processMatches == 'doubleUrlDecode') {
			repl = unescape(unescape(repl.replace("+"." ")).replace("+"." "));

Thanks for everything!

ariel-co avatar Feb 21 '21 11:02 ariel-co

Makes sense, I'll try to get that into the next release.

einaregilsson avatar Feb 24 '21 10:02 einaregilsson

@ariel-co Do you know if Einar ever had a chance to publish that change? I found this thread because I'm trying to solve the same problem, and I'm not sure if I'm doing it wrong in Redirector or if I just need to take some other approach to solve it

e-t-l avatar Feb 05 '24 00:02 e-t-l

Doesn't seem like: https://github.com/einaregilsson/Redirector/blame/master/js/redirect.js#L277

For my case I found by chance a URL where the keywords are proper query string parameters, e.g. https://jisho.org/search?keyword=black+tea. Maybe snoop around the site you're dealing with a bit, try to guess or ask the developers.

Or, look into one of the forks?

ariel-co avatar Feb 05 '24 22:02 ariel-co