all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Lorenz Stechauner <l.stechauner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 1/2] ui: cloudinit: use PVE.Parser.parseSSHKey
Date: Fri, 14 May 2021 12:13:16 +0200	[thread overview]
Message-ID: <20210514101317.66840-2-l.stechauner@proxmox.com> (raw)
In-Reply-To: <20210514101317.66840-1-l.stechauner@proxmox.com>

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
---
 www/manager6/qemu/CloudInit.js | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/www/manager6/qemu/CloudInit.js b/www/manager6/qemu/CloudInit.js
index ccd1840b..43405a67 100644
--- a/www/manager6/qemu/CloudInit.js
+++ b/www/manager6/qemu/CloudInit.js
@@ -264,13 +264,10 @@ Ext.define('PVE.qemu.CloudInit', {
 		    var text = [];
 		    keys.forEach(function(key) {
 			if (key.length) {
-			    // First erase all quoted strings (eg. command="foo"
-			    var v = key.replace(/"(?:\\.|[^"\\])*"/g, '');
-			    // Now try to detect the comment:
-			    var res = v.match(/^\s*(\S+\s+)?(?:ssh-(?:dss|rsa|ed25519)|ecdsa-sha2-nistp\d+)\s+\S+\s+(.*?)\s*$/, '');
+			    let res = PVE.Parser.parseSSHKey(key);
 			    if (res) {
-				key = Ext.String.htmlEncode(res[2]);
-				if (res[1]) {
+				key = Ext.String.htmlEncode(res.comment);
+				if (res.options) {
 				    key += ' <span style="color:gray">(' + gettext('with options') + ')</span>';
 				}
 				text.push(key);
-- 
2.20.1





  reply	other threads:[~2021-05-14 10:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14 10:13 [pve-devel] [PATCH manager 0/2] fix #3426: ui: parser: adapt parseSSHKey to accept "sk-" prefix Lorenz Stechauner
2021-05-14 10:13 ` Lorenz Stechauner [this message]
2021-05-14 10:13 ` [pve-devel] [PATCH manager 2/2] " Lorenz Stechauner
2021-05-17 13:44 ` [pve-devel] applied-series: [PATCH manager 0/2] " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210514101317.66840-2-l.stechauner@proxmox.com \
    --to=l.stechauner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal