shwstppr commented on code in PR #7749:
URL: https://github.com/apache/cloudstack/pull/7749#discussion_r1270288795


##########
ui/src/utils/plugins.js:
##########
@@ -484,6 +484,22 @@ export const genericUtilPlugin = {
       const regexExp = 
/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi
       return regexExp.test(uuid)
     }
+
+    app.config.globalProperties.$toBase64Encoded = function (text) {
+      const base64regex = 
/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/
+      if (base64regex.test(text)) {
+        return text
+      }
+      return btoa(unescape(encodeURIComponent(text)))
+    }
+
+    app.config.globalProperties.$toBase64AndURIEncoded = function (text) {
+      const base64regex = 
/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/
+      if (base64regex.test(text)) {

Review Comment:
   @weizhouapache why would user want to pass a double base64 encoded string?
   cloud-init doesn't have a data format for that, 
https://cloudinit.readthedocs.io/en/latest/explanation/format.html
   Even if user wants that in some scenarios it can be done manually.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to