This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch 4.18
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.18 by this push:
     new 87f218c68cd UI: decode userdata in EditVM dialog (#7796)
87f218c68cd is described below

commit 87f218c68cd1d66020040fb23d447b6aa18b5fa2
Author: Wei Zhou <weiz...@apache.org>
AuthorDate: Tue Aug 1 15:10:26 2023 +0800

    UI: decode userdata in EditVM dialog (#7796)
---
 ui/src/views/compute/EditVM.vue | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ui/src/views/compute/EditVM.vue b/ui/src/views/compute/EditVM.vue
index 9aae2f38755..1fbbd5ee2eb 100644
--- a/ui/src/views/compute/EditVM.vue
+++ b/ui/src/views/compute/EditVM.vue
@@ -283,6 +283,10 @@ export default {
         this.$notifyError(error)
       }).finally(() => { this.groups.loading = false })
     },
+    decodeUserData (userdata) {
+      const decodedData = Buffer.from(userdata, 'base64')
+      return decodedData.toString('utf-8')
+    },
     fetchUserData () {
       const params = {
         id: this.resource.id,
@@ -290,7 +294,7 @@ export default {
       }
 
       api('listVirtualMachines', params).then(json => {
-        this.form.userdata = 
atob(json.listvirtualmachinesresponse.virtualmachine[0].userdata || '')
+        this.form.userdata = 
this.decodeUserData(json.listvirtualmachinesresponse.virtualmachine[0].userdata 
|| '')
       })
     },
     handleSubmit () {

Reply via email to