[gnome-boxes/gnome-3-14] unattended-file: More reliable test for raw images



commit 9a93e4b1adb38224ab62fc046112f2b9f56b05be
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Jul 17 16:32:09 2015 +0100

    unattended-file: More reliable test for raw images
    
    The issue with checking if content type is
    "application/x-raw-disk-image", is that it fails on systems with slighly
    older shared-mime-info where the content_type is detected as
    "application-octetstream".

 src/unattended-file.vala |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/unattended-file.vala b/src/unattended-file.vala
index 02aa92e..fbc8b76 100644
--- a/src/unattended-file.vala
+++ b/src/unattended-file.vala
@@ -66,8 +66,13 @@ private interface Boxes.UnattendedFile : GLib.Object {
     private static bool is_libarchive_compatible (string filename) {
         // FIXME: We need better way to determine libarchive compatibility cause mcopy is used
         //        if this function returns false and mcopy can only handle MS-DOS images while
-        //        libarchive can handle other types of disk images
-        return GLib.ContentType.guess (filename, null, null) != "application/x-raw-disk-image";
+        //        libarchive can handle other types of disk images.
+        //
+        //        Just in case you get the idea to compare the content_type to
+        //        "application/x-raw-disk-image", that's what we were doing but then it failed
+        //        on systems with slighly older shared-mime-info where the content_type is
+        //        detected as 'application-octetstream'.
+        return !filename.has_suffix (".img") && !filename.has_suffix (".IMG");
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]