Bug 141232

Summary: Quanta+ fails to create new remote directories on some FTP servers
Product: quanta Reporter: Markus <darkvision>
Component: generalAssignee: András Manţia <amantia>
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Markus 2007-02-05 19:57:56 UTC
Version:           3.5.5 (using KDE KDE 3.5.5)
Installed from:    Compiled From Sources
Compiler:          gcc-Version 3.4.6 
OS:                Linux

When i create a new directory in my project with a small index.html the upload will fail because the new directory cannot be created on remote server(ftp). Quanta+ tells me that i should check permissions on the FTP. But it can't be a permission problem since other uploads to existing directories do work.

I tried to find the problem and here is what i found out.

First i tried to create the new directory on my local FTP to get a list of commands Quanta+ is using during file upload. On the remote server(FTP) a folder /doc does already exist, the new directory to be created is named "Test". Here's what my FTP server told me about the Quanta-commands:

[DEBUG] 257 "/" is your current location
[DEBUG] Command [cwd] [/doc/Test]
[INFO] Can't change directory to /doc/Test: No such file or directory
[DEBUG] 550 Can't change directory to /doc/Test: No such file or directory
[DEBUG] Command [type] [I]
[DEBUG] 200 TYPE is now 8-bit binary
[DEBUG] Command [size] [/doc/Test]
[DEBUG] 550 Can't check for file existence
[DEBUG] Command [cwd] [/doc]
[DEBUG] 250 OK. Current directory is /doc
[DEBUG] Command [mkd] [/doc/Test/]
[DEBUG] 257 "/doc/Test/" : The directory was successfully created

Please have a look to the mkd command. It looks like Quanta+ is using /doc/Test/ when trying to create a new directory. If i use these commands on the remote server(FTP) of my ISP/Webhosting service i get this:

ftp> size /doc/Test
 550 /doc/Test: No such file or directory.
ftp> cd /doc
 250 CWD command successful. 
ftp> mkdir /doc/Test/
 553 Could not determine cwdir: No such file or directory.

While using 'mkdir /doc/Test/' on my lokal FTP seem to work my ISP does misunderstand this command. If i want to create a new directory on my ISP's FTP i have to use:

ftp> mkdir /doc/Test
 257 MKD command successful.

A '/' at the end of the directory that should be created seem not to work on every FTP server.

Comment 1 András Manţia 2007-02-05 20:18:47 UTC
Can you create a new directory on that server with Konqueror using the 
ftp:// protocol?
Comment 2 Markus 2007-02-05 20:27:13 UTC
Yes, that works without any problems.

Comment 3 Markus 2007-02-05 20:35:17 UTC
I debugged this with my local server and Konqueror does not use a '/' at the end of the mkd command:

[DEBUG] 257 "/" is your current location
[DEBUG] Command [type] [I]
[DEBUG] 200 TYPE is now 8-bit binary
[DEBUG] Command [pasv] []
[DEBUG] 227 Entering Passive Mode (*******)
[DEBUG] Command [list] [-la]
[DEBUG] 150 Accepted data connection
[DEBUG] 226-Options: -a -l 
[DEBUG] 226 2 matches total
[DEBUG] Command [mkd] [/Test]
[DEBUG] 257 "/Test" : The directory was successfully created
Comment 4 András Manţia 2007-02-05 21:11:44 UTC
Ok, this is new to me. Thanks for your help, I will fix the bug for the 
next version (3.5.7), but that won't appear soon. You will get a mail 
once it is fixed.
Comment 5 András Manţia 2007-02-06 21:40:58 UTC
SVN commit 630937 by amantia:

Fix directory creation when certain ftp servers are used.

BUG: 141232

 M  +4 -2      lib/qextfileinfo.cpp  
 M  +5 -1      quanta/ChangeLog  
 M  +10 -10    quanta/quanta.kdevelop  
 M  +3 -1      quanta/utility/quantanetaccess.cpp  

--- branches/KDE/3.5/kdewebdev/lib/qextfileinfo.cpp #630936:630937
@@ -192,6 +192,7 @@
   int i = 0;
   bool result;
+  KURL dir3; 
   KURL dir2;
   KURL dir1 = path;
@@ -211,8 +212,9 @@
       dir2 = cdUp(dir2);
     //  debug(d1);
-  //  dir2.setPath(dir2.path(-1));
-    result = KIO::NetAccess::mkdir(dir2, window);
+    dir3 = dir2;
+    dir3.adjustPath(-1); //some servers refuse to create directories ending with a slash
+    result = KIO::NetAccess::mkdir(dir3, window);
     if (dir2.path() == "/" || !result)
--- branches/KDE/3.5/kdewebdev/quanta/ChangeLog #630936:630937
@@ -1,7 +1,11 @@
 This files contains the changes since Quanta 2.0 until the current 3.5.x series.
-Version 3.5.6 (Release date: xx-xx-2006; Started 01-09-2006):
+Version 3.5.7 (Release date: xx-xx-2006; Started 06-02-2006)
  - bugfixes:
+      - fix directory creation when certain ftp servers are used [#141232]
+Version 3.5.6 (Release date: 26-01-2006; Started 12-10-2006):
+ - bugfixes:
       - show Find in Files menu if KFileReplace is installed [related to #132530]
       - fix various crashes in the debugger [#137483]
       - fix crash when editing a <style> CSS area
--- branches/KDE/3.5/kdewebdev/quanta/quanta.kdevelop #630936:630937
@@ -17,8 +17,8 @@
-    <versioncontrol></versioncontrol>
-    <defaultencoding></defaultencoding>
+    <versioncontrol/>
+    <defaultencoding/>
@@ -184,7 +184,7 @@
-      <hidepatterns/>
+      <hidepatterns></hidepatterns>
@@ -207,16 +207,16 @@
-      <dbgshell></dbgshell>
+      <dbgshell/>
-      <configGdbScript></configGdbScript>
-      <runShellScript></runShellScript>
-      <runGdbScript></runGdbScript>
+      <configGdbScript/>
+      <runShellScript/>
+      <runGdbScript/>
@@ -259,10 +259,10 @@
-      <type icon="" ext="h" name="C++ header" create="template" >
+      <type icon="" ext="h" create="template" name="C++ header" >
         <descr>Quanta speicfic header</descr>
-      <type icon="source_cpp" ext="cpp" name="C++ source" create="template" >
+      <type icon="source_cpp" ext="cpp" create="template" name="C++ source" >
         <descr>A new empty C++ file.</descr>
@@ -298,7 +298,7 @@
-      <prefixGet></prefixGet>
+      <prefixGet/>
--- branches/KDE/3.5/kdewebdev/quanta/utility/quantanetaccess.cpp #630936:630937
@@ -158,7 +158,9 @@
 bool QuantaNetAccess::mkdir( const KURL & url, QWidget* window, int permissions, bool confirm )
-  bool ok = KIO::NetAccess::mkdir( url, window, permissions );
+  KURL u = url;
+  u.adjustPath(-1); //some servers refuse to create directories ending with a slash
+  bool ok = KIO::NetAccess::mkdir( u, window, permissions );
   if (ok) {
     checkProjectInsert(url, window, confirm);
   } else {
Comment 6 Markus 2007-02-08 05:55:20 UTC

thanks for the patch. I applied it to Quanta 3.5.6 and tested upload of new directories. Seem to work.