DaanHoogland commented on issue #3202: Userdata incorrectly encoded URL: https://github.com/apache/cloudstack/issues/3202#issuecomment-473895683 The removal of the class was not enough, but I found the code that let's jquery do the automatic en-/decoding. It does this using the methods sanatize and sanatizeReverse from ui/utils.js so I wrote a piece of code that undoes it before passing it on to the API: ``` commit 0cbc25d83f62f7e37774a86fa09330818e603cc9 (HEAD -> base64-userdata, sb/base64-userdata) Author: Daan Hoogland <[email protected]> Date: Mon Mar 18 12:30:12 2019 +0000 reverse character replacements that are generic for all fields and hurt userdata diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js index 351ca7b302..3a85e66269 100644 --- a/ui/scripts/instanceWizard.js +++ b/ui/scripts/instanceWizard.js @@ -1094,8 +1094,15 @@ var userdata = args.data.userdata; if (userdata != null && userdata.length > 0) { + + // NOTE code duplicated from sanatizeReverse in ui/utils.js because of call propagation issues + userdata = userdata + .replace(/&/g, "&") + .replace(/</g, "<") + .replace(/>/g, ">"); + $.extend(deployVmData, { - userdata : encodeURIComponent(btoa(userdata)) + userdata : btoa(userdata) }); } ``` No other characters are encoded as far as I can tell but we might define a reassuring large set to test agains. (@borisstoyanov ?)
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
