[gnome-boxes] unattended-file: More reliable test for raw images
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] unattended-file: More reliable test for raw images
- Date: Fri, 17 Jul 2015 16:56:35 +0000 (UTC)
commit 8aeb2db0f19f104a48827aeab11c83b004a2fd7d
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 7d8bead..55e8680 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]