Charles Plessy, Mon, Jul 01, 2019 15:26:03 +0200:
> Le Mon, Jul 01, 2019 at 09:05:36AM +0200, Alex Riesen a écrit :
> > 
> >                             elsif (m/MimeType=(.*)/i) {
> > -                                   push @types, split(/;/, $1);
> > +                                   push @types, grep {length>0} 
> > split(/\s*;\s*/, $1);
> 
> Do you think it would make sense to throw a warning on stderr when such
> a broken entry is found ?  In that case, would you have time to propose
> an updated patch ?

Of course. Like the below, perhaps? (I still filter them out).

Regards,
Alex


diff --git a/update-mime b/update-mime
index d27b8a9..55495ee 100755
--- a/update-mime
+++ b/update-mime
@@ -157,7 +157,10 @@ sub ReadDesktopEntries
                                        $exec .= " %s" if ($exec !~ m/%s/);
                                }
                                elsif (m/MimeType=(.*)/i) {
-                                       push @types, split(/;/, $1);
+                                       my $err = 0;
+                                       push @types, grep { if (length>0) {1} 
else {++$err;0} }
+                                                    split(/\s*;\s*/, $1);
+                                       print STDERR "Warning: $file:$.: 
ignoring empty entries in MimeType\n" if $err;
                                }
                        }
                        if (!defined($exec) || !scalar(@types)) {

Reply via email to