Closed 5minpause closed 6 years ago
I think the redirector should be parameter-sensitive. They should not be added automatically if a similarGoldencobra::Redirector
is present.
The test mentioned should not redirect.
http://www.yourdomain.de/weiterleitung?test=1&foo=bar should redirect to http://www.google.de?foo=bar&test=1 only, if exactly this is given as a Goldencobra::Redirector
. Not because of http://www.yourdomain.de/weiterleitung?test=1 targets http://www.google.de.
Do you agree, that there should be new UrlParams associated with a Redirector? This would make the order of the params irelevant.
Yes, the order of the params must not matter.
Then we should work on this. It's well enough scoped I hope and we also have already failing tests.
This test: https://github.com/ikuseiGmbH/Goldencobra/blob/69a1ab26b789282abc0a71a47675c233618d994c/test/dummy/spec/models/redirector_spec.rb#L193-L200
does not work. This is why:
https://github.com/ikuseiGmbH/Goldencobra/blob/69a1ab26b789282abc0a71a47675c233618d994c/app/models/goldencobra/redirector.rb#L70-L104
In line 79, we try to match the request with existing redirector records, but only match with the given request-path, ignoring any url params. The existing redirector record does have a parameter at the end, though. So it cannot match.
Our current idea is, to expand the
Goldencobra::Redirector
model with new url-parameter attributes. The matching would then again be done by the param-free url path, and additionally taking any given url-params into consideration.