Skip to content

Commit 87f218c

Browse files
UI: decode userdata in EditVM dialog (#7796)
1 parent 60ab494 commit 87f218c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ui/src/views/compute/EditVM.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,18 @@ export default {
283283
this.$notifyError(error)
284284
}).finally(() => { this.groups.loading = false })
285285
},
286+
decodeUserData (userdata) {
287+
const decodedData = Buffer.from(userdata, 'base64')
288+
return decodedData.toString('utf-8')
289+
},
286290
fetchUserData () {
287291
const params = {
288292
id: this.resource.id,
289293
userdata: true
290294
}
291295
292296
api('listVirtualMachines', params).then(json => {
293-
this.form.userdata = atob(json.listvirtualmachinesresponse.virtualmachine[0].userdata || '')
297+
this.form.userdata = this.decodeUserData(json.listvirtualmachinesresponse.virtualmachine[0].userdata || '')
294298
})
295299
},
296300
handleSubmit () {

0 commit comments

Comments
 (0)