Problem/Motivation
On multilingual site (with path prefix) redirect page, for example node/100 is aliased and includes language prefix too early. This lead user's to be redirected from example.com/en/webform-page to example.com/en/en/redirect-page.
Proposed resolution
Clean up aliased redirect url if current language has path-prefix.
User interface changes
none.
API changes
none.
Comments
Comment #1
rpsuProposed solution is to check if $language has prefix and if so, strip prefix + / off.
Comment #2
Prancz_Adam commentedSame issue here.
Comment #3
rpsuAnd this patch applies to 7.x-4.x-rc3.
Comment #4
matglas86 commentedI re-applied this patch to the latest head because it did not work.
I tested it and it works.
Comment #5
danchadwick commentedComment #8
danchadwick commentedTwo things.
First, I just committed another change in this area of the code, so a re-roll against the current 7.x-4.x-dev will be needed for any fix.
Second, the code just assumes that the language prefix is at the start of the generated URL. This would not be the case for external URLs. I don't know enough about how the language prefix works to make a concrete suggestion. If the $language->prefix is a non-empty string, then does every single URL on the site for this language have the prefix? If so, then it would probably be easiest to include the language prefix in the regular expression used to strip base_url. The issue is that it would think that any URL's that don't have the language prefix (or have a different language) are external.
Comment #10
danchadwick commentedI can't test this because I don't have a multi-language installation. If someone wants to download the latest dev (23-May-2014) and try changing the preg_replace call in webform_replace_url_tokens in webform.module to the following, then we'll know if this works:
EDIT: Obsolete code deleted.
Comment #11
danchadwick commentedComment #12
danchadwick commentedThis patch fixed a problem in #10 and improves on it. It removes the base_url and, if there is a language prefix, removes that too if it is present in the URL.
Someone with a multi-language should test this. I'm pretty confident it still works for a single language (no language prefix) installation.
Comment #13
danchadwick commentedSorry. Bad patch in #12 (typo $GLOVALS and duplicated / in regular expression). Revised patch tested and applied to 7.x-4.x and 8.x
Comment #14
rpsuThanks, tested with path_prefix like example.com/en/webform-node -> example.com/en/aliased-node-path. (7.x-4.x)
Comment #16
danchadwick commented