[pve-devel] [PATCH v3 manager 3/3] ui: cert upload: fix private key field sending empty string

Max Carrara m.carrara at proxmox.com
Tue Mar 14 16:08:39 CET 2023


The private key's field is now excluded from the upload form's
JSON data if it's left empty.

Prior to this change, the form still used an empty string for the
private key's field, even if no key was provided by the user.
Because the key's field is marked as optional in the upload cert
API endpoint, JSONSchema validation would therefore fail.

Signed-off-by: Max Carrara <m.carrara at proxmox.com>
---
 www/manager6/node/Certificates.js | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/www/manager6/node/Certificates.js b/www/manager6/node/Certificates.js
index 29c17359..a086581c 100644
--- a/www/manager6/node/Certificates.js
+++ b/www/manager6/node/Certificates.js
@@ -171,6 +171,9 @@ Ext.define('PVE.node.CertUpload', {
 	onGetValues: function(values) {
 	    values.restart = 1;
 	    values.force = 1;
+	    if (!values.key) {
+		delete values.key;
+	    }
 	    return values;
 	},
 	items: [
-- 
2.39.2






More information about the pve-devel mailing list