-
Committer:
Xavier Morel
-
Date:
2011-07-08 10:54:52 UTC
-
Revision ID:
xmo@openerp.com-20110708105452-hrgty8s10zyrhdnb
[FIX] double-action execution in case of opening action URLs containing spaces
URLs are moved to hash-parameters in order to have navigation between 'pages' (bookmarking as well as forward/back support). The encoding was performed using jQuery.param (encodes the URI provided and sets it as a 'query parameter' with the right name for decoding).
However, it turns out jQuery.param does not merely call 'encodeURIComponent' on the key and the value (separately), it also re-encodes all spaces as '+' (instead of the normal '%20'). This does *not* round-trip through decodeURIComponent.
As a result, we'd store the action URI as 'current uri' and set it as the hash, this would trigger a hashchange which would compare the 'current uri' and the one in the hash (which were set to the same value)... and would find them to be different (due to the '+' encoding of spaces which apparently is not handled by decodeURIComponent), which would lead to a *new* action execution using the +-based action uri. This one would be stored (again), new hashchange triggerd which this time would find the URIs to be identical and would avoid further processing.