[gnome-boxes] wizard: More thorough validation of local URIs
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] wizard: More thorough validation of local URIs
- Date: Tue, 17 Feb 2015 14:28:49 +0000 (UTC)
commit c1056e122c16b0f9795d63f2e8bc984d7b67213c
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon Feb 16 17:27:52 2015 +0000
wizard: More thorough validation of local URIs
Check if the file is of a supported extension and has correct file type.
src/wizard.vala | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/wizard.vala b/src/wizard.vala
index 64ddf75..cb2c0d9 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -279,6 +279,25 @@ private class Boxes.Wizard: Gtk.Stack, Boxes.UI {
if (path != null && (file.has_uri_scheme ("file") || file.has_uri_scheme ("smb"))) {
if (!probing)
prepare_for_installer (path, progress);
+ else {
+ var supported = false;
+ var extensions = InstalledMedia.supported_extensions;
+ extensions += "iso";
+ foreach (var extension in extensions)
+ if (path.has_suffix (extension)) {
+ supported = true;
+
+ break;
+ }
+ if (!supported)
+ throw new Boxes.Error.INVALID (_("Unsupported file"));
+
+ var info = file.query_info (FileAttribute.STANDARD_TYPE, FileQueryInfoFlags.NONE, null);
+ var file_type = info.get_file_type ();
+
+ if (file_type != FileType.REGULAR && file_type != FileType.SYMBOLIC_LINK)
+ throw new Boxes.Error.INVALID (_("Invalid file"));
+ }
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]