[gnome-boxes] wizard: Allow entering of HTTP(S) URIs



commit cf8ed3ec73fa62cfed50a44ffe5f48f1d907b8ae
Author: Lasse Schuirmann <lasse schuirmann gmail com>
Date:   Mon Jul 14 17:11:24 2014 +0200

    wizard: Allow entering of HTTP(S) URIs
    
    And also validate URI has a proper basename.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=729026

 src/wizard.vala |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/wizard.vala b/src/wizard.vala
index 36932dd..333f367 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -261,7 +261,6 @@ private class Boxes.Wizard: Gtk.Stack, Boxes.UI {
         var path = file.get_path ();
 
         if (path != null && (file.has_uri_scheme ("file") || file.has_uri_scheme ("smb"))) {
-            // FIXME: We should able to handle non-local URIs here too
             if (!probing)
                 prepare_for_installer (path, progress);
 
@@ -287,10 +286,19 @@ private class Boxes.Wizard: Gtk.Stack, Boxes.UI {
 
     private void prepare_for_uri (string uri_as_text) throws Boxes.Error {
         var uri = Xml.URI.parse (uri_as_text);
-
         if (uri == null || uri.scheme == null)
             throw new Boxes.Error.INVALID (_("Invalid URI"));
 
+        if (wizard_source.download_required) {
+            var file = File.new_for_uri (uri_as_text);
+            var basename = file.get_basename ();
+
+            if (basename == null || basename == "" || basename == "/")
+                throw new Boxes.Error.INVALID (_("Invalid URI"));
+
+            return;
+        }
+
         source = new CollectionSource (uri.server ?? uri_as_text, uri.scheme, uri_as_text);
 
         if (uri.scheme == "spice") {


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