]> git.proxmox.com Git - pmg-api.git/commitdiff
api mime: really return mimetypes, not undef
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 28 Aug 2019 12:29:23 +0000 (14:29 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 28 Aug 2019 12:30:36 +0000 (14:30 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PMG/API2/MimeTypes.pm

index 9d5e952e05302ff0ed69f7dce3253071fe546eff..5ab8f7eecced97c64c64e509b7645c2927805f84 100644 (file)
@@ -7,9 +7,8 @@ use PVE::RESTHandler;
 
 use base qw(PVE::RESTHandler);
 
-my $mime = [];
-
 my $load_mime_types = sub {
+
     my $mtypes = {
        'message/delivery-status' => undef,
        'message/disposition-notification' => undef,
@@ -52,6 +51,7 @@ my $load_mime_types = sub {
     # sort and add wildcard entries
     my $lasttype='';
 
+    my $mime = [];
     foreach my $mt (sort (keys %$mtypes)) {
        my ($type, $subtype) = split ('/', $mt);
 
@@ -64,6 +64,8 @@ my $load_mime_types = sub {
 
        push (@$mime, { mimetype => $mt, text => $text });
     }
+
+    return $mime;
 };
 
 __PACKAGE__->register_method ({
@@ -87,7 +89,7 @@ __PACKAGE__->register_method ({
     code => sub {
        my ($param) = @_;
 
-       $mime = $load_mime_types->();
+       my $mime = $load_mime_types->();
 
        return $mime;
     }});