]> git.proxmox.com Git - pve-common.git/commitdiff
tools: template_replace: esacpe braces
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Sun, 18 Nov 2018 15:06:19 +0000 (16:06 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 19 Nov 2018 09:05:54 +0000 (10:05 +0100)
To avoid warnings (and in the future, errors) like:

> Unescaped left brace in regex is deprecated here (and will be fatal
> in Perl 5.32), passed through in regex; marked by <-- HERE in
> m/([^{]+)?({ <-- HERE ([^}]+)})?/ at /usr/share/perl5/PVE/Tools.pm
> line 673.

with future perl versions, like Debian Buster for example has.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/Tools.pm

index 6254b2e653624880ab67fd35fcb581303caa6463..0f31fdbe6f4f98750be4b8e0c9098416cd6a85a9 100644 (file)
@@ -670,7 +670,7 @@ sub template_replace {
     return $tmpl if !$tmpl;
 
     my $res = '';
     return $tmpl if !$tmpl;
 
     my $res = '';
-    while ($tmpl =~ m/([^{]+)?({([^}]+)})?/g) {
+    while ($tmpl =~ m/([^{]+)?(\{([^}]+)\})?/g) {
        $res .= $1 if $1;
        $res .= ($data->{$3} || '-') if $2;
     }
        $res .= $1 if $1;
        $res .= ($data->{$3} || '-') if $2;
     }