[Kimchi-devel] [PATCH 5/5] Reflect the unicode conversion on token creation

Aline Manera alinefm at linux.vnet.ibm.com
Mon May 4 19:00:10 UTC 2015



On 28/04/2015 10:16, Ramon Medeiros wrote:
> In the backend, the token is created after a convertion of unicode, so,
> the token passed by the ui will be forcely converted to unicode.
>
> Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
> ---
>   ui/js/src/kimchi.api.js | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
> index 5c36418..0f24a47 100644
> --- a/ui/js/src/kimchi.api.js
> +++ b/ui/js/src/kimchi.api.js
> @@ -362,7 +362,7 @@ var kimchi = {
>                    * contain = which is not safe in a URL query component.
>                    * So remove it when needed as base64 can work well without it.
>                    * */
> -                url += "&path=?token=" + kimchi.urlSafeB64Encode(vm).replace(/=*$/g, "");
> +                url += "&path=?token=" + kimchi.urlSafeB64Encode(unescape(encodeURIComponent(vm))).replace(/=*$/g, "");
>                   url += "&kimchi=" + location.port;
>                   url += '&encrypt=1';
>                   window.open(url);
> @@ -394,7 +394,7 @@ var kimchi = {
>                    * contain = which is not safe in a URL query component.
>                    * So remove it when needed as base64 can work well without it.
>                    * */
> -                url += "&token=" + kimchi.urlSafeB64Encode(vm).replace(/=*$/g, "");
> +                url += "&token=" + kimchi.urlSafeB64Encode(unescape(encodeURIComponent(vm))).replace(/=*$/g, "");
>                   url += "&kimchi=" + location.port;
>                   url += '&encrypt=1';
>                   window.open(url);

Probably, you will need to change it if backend uses 
"errors=xmlcharrefreplace"





More information about the Kimchi-devel mailing list