[gnome-boxes/wip/feborges/ssh: 15/16] wizard: Don't parse the URIs twice



commit 6ee4943062f8bbc2a726c3da181e327968d0d741
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon Nov 26 15:54:23 2018 +0100

    wizard: Don't parse the URIs twice
    
    We are identifying the schemes using two different APIs. GFile's
    and libxml. This causes issues with specific protocols being
    mapped to others differently.
    
    For instance, an "ssh://" URI is mapped to "sftp://"; by the GFile
    API. These are two different sources for Boxes. The first is an
    SSH connection while the later refers to a secure file transfer
    operation.

 src/wizard.vala | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/wizard.vala b/src/wizard.vala
index bd82a6cd..056d9a0b 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -335,11 +335,11 @@ private void prepare_for_location (string            location,
             return;
         }
 
-        prepare_for_uri (file.get_uri (), filename);
+        prepare_for_uri (file.get_uri (), filename, location);
     }
 
-    private void prepare_for_uri (string uri_as_text, string? filename = null) throws Boxes.Error {
-        var uri = Xml.URI.parse (uri_as_text);
+    private void prepare_for_uri (string uri_as_text, string? filename = null, string? location = null) 
throws Boxes.Error {
+        var uri = Xml.URI.parse (location);
         if (uri == null || uri.scheme == null)
             throw new Boxes.Error.INVALID (_("Invalid URL"));
 
@@ -359,7 +359,7 @@ private void prepare_for_uri (string uri_as_text, string? filename = null) throw
             return;
         }
 
-        source = new CollectionSource (uri.server ?? uri_as_text, uri.scheme, uri_as_text);
+        source = new CollectionSource (uri.server ?? location, uri.scheme, location);
 
         if (uri.scheme.has_prefix ("spice")) {
             spice_validate_uri (uri_as_text);


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