tags 690334 + patch
kthxbye

Attached is a patch to fix the bug with image/svg+xml.  With this patch,
I see the following, whereas there was no output before:

  vauxhall ok % perl -MFile::MimeInfo::Applications -E '@x=map { 
$_->get("Exec") }grep{$_}mime_applications("image/svg+xml"); say "@x";'  
  geeqie -r %F gimp-2.8 %U ristretto %F

I have not included any tests for this change.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
From 7ae0f8640dde7316b42db4874c9ccc6fed9d7940 Mon Sep 17 00:00:00 2001
From: "brian m. carlson" <sand...@crustytoothpaste.net>
Date: Fri, 31 May 2013 20:06:56 +0000
Subject: [PATCH] Properly escape MIME types containing +.

Previously, MIME types were placed as-is into regular expressions.  This caused
problems for types such as image/svg+xml and breaking mimeopen.  Now the MIME
types are escaped so that they are matched properly.
---
 lib/File/MimeInfo/Applications.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/File/MimeInfo/Applications.pm b/lib/File/MimeInfo/Applications.pm
index 645861b..6eea4f0 100644
--- a/lib/File/MimeInfo/Applications.pm
+++ b/lib/File/MimeInfo/Applications.pm
@@ -120,7 +120,7 @@ sub _read_list { # read list with "mime/type=foo.desktop;bar.desktop" format
 	my @list;
 	open LIST, '<', $file or croak "Could not read file: $file";
 	while (<LIST>) {
-		/^$mimetype=(.*)$/ or next;
+		/^\Q$mimetype\E=(.*)$/ or next;
 		push @list, grep defined($_), split ';', $1;
 	}
 	close LIST;
@@ -135,7 +135,7 @@ sub _write_list {
 	if (-f $file) {
 		open LIST, '<', $file or croak "Could not read file: $file";
 		while (<LIST>) {
-			$text .= $_ unless /^$mimetype=/;
+			$text .= $_ unless /^\Q$mimetype\E=/;
 		}
 		close LIST;
 		$text =~ s/[\n\r]?$/\n/; # just to be sure
-- 
1.8.0

Attachment: signature.asc
Description: Digital signature

Reply via email to