[gnome-commander] The built path should not start with two '/' characters



commit 466e18829ba29e0643b6cf855a3e3be277be91f5
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Tue Oct 5 08:50:33 2021 +0200

    The built path should not start with two '/' characters
    
    Also, the path should not be separated from the host by an escaped '/' character.

 src/gnome-cmd-con.cc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/gnome-cmd-con.cc b/src/gnome-cmd-con.cc
index dbaa421a..7040a359 100644
--- a/src/gnome-cmd-con.cc
+++ b/src/gnome-cmd-con.cc
@@ -641,8 +641,6 @@ string &__gnome_cmd_con_make_uri (string &s, const gchar *method, gboolean use_a
 #ifdef HAVE_SAMBA
 std::string &gnome_cmd_con_make_smb_uri (std::string &s, gboolean use_auth, std::string &server, std::string 
&share, std::string &folder, std::string &domain, std::string &user, std::string &password)
 {
-    share = '/' + share;
-
     user = stringify (g_strescape (user.c_str(), nullptr));
     password = stringify (g_strescape (password.c_str(), nullptr));
 
@@ -658,7 +656,11 @@ std::string &gnome_cmd_con_make_smb_uri (std::string &s, gboolean use_auth, std:
     const gchar *joinSign = !folder.empty() && folder[0] != '/' ? "/" : "";
 
     folder = share + joinSign + folder;
-    folder = stringify (g_uri_escape_string (folder.c_str(), nullptr, true));
+    // remove initial '/' character
+    if (folder.length() > 0 && folder[0] == '/')
+    {
+        folder = folder.length() == 1 ? folder.erase() : folder.substr(1);
+    }
 
     s = "smb://";
 
@@ -666,6 +668,7 @@ std::string &gnome_cmd_con_make_smb_uri (std::string &s, gboolean use_auth, std:
         s += user + '@';
 
     s += server;
+    s += "/";
     s += folder;
 
     return s;


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