]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/JSONSchema.pm
improve parse_config in JSONSchema and SectionConfig
[pve-common.git] / src / PVE / JSONSchema.pm
index 36a2de994e35cf1c7f8f4655a4f13c0334e6f5fc..d9d254af6e886df4168eed6113c28e1d63d4d8c3 100644 (file)
@@ -1150,13 +1150,12 @@ sub parse_config {
 
     my $cfg = {};
 
-    while ($raw && $raw =~ s/^(.*?)(\n|$)//) {
+    while ($raw =~ /^\s*(.+?)\s*$/gm) {
        my $line = $1;
-       next if $line =~ m/^\#/; # skip comment lines
-       next if $line =~ m/^\s*$/; # skip empty lines
 
-       if ($line =~ m/^(\S+):\s*(\S+)\s*$/) {
+       next if $line =~ /^#/;
+
+       if ($line =~ m/^(\S+?):\s*(.*)$/) {
            my $key = $1;
            my $value = $2;
            if ($schema->{properties}->{$key} &&