Bug 141232 - Quanta+ fails to create new remote directories on some FTP servers
Summary: Quanta+ fails to create new remote directories on some FTP servers
Status: RESOLVED FIXED
Alias: None
Product: quanta
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: András Manţia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-05 19:57 UTC by Markus
Modified: 2007-02-08 05:55 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.

Markus
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.

Markus
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-ASCII
[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;
   dir1.setPath("/");
@@ -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)
       break;
     i++;
--- 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 @@
     <projectdirectory>.</projectdirectory>
     <absoluteprojectpath>false</absoluteprojectpath>
     <secondaryLanguages/>
-    <versioncontrol></versioncontrol>
-    <defaultencoding></defaultencoding>
+    <versioncontrol/>
+    <defaultencoding/>
     <projectname>quanta</projectname>
   </general>
   <kdevautoproject>
@@ -184,7 +184,7 @@
     </groups>
     <tree>
       <hidenonprojectfiles>false</hidenonprojectfiles>
-      <hidepatterns/>
+      <hidepatterns></hidepatterns>
       <showvcsfields>true</showvcsfields>
     </tree>
   </kdevfileview>
@@ -207,16 +207,16 @@
   </kdevdoctreeview>
   <kdevdebugger>
     <general>
-      <dbgshell></dbgshell>
+      <dbgshell/>
       <programargs/>
       <gdbpath>/usr/bin/gdb</gdbpath>
       <breakonloadinglibs>true</breakonloadinglibs>
       <separatetty>false</separatetty>
       <floatingtoolbar>false</floatingtoolbar>
       <runappinappdirectory>true</runappinappdirectory>
-      <configGdbScript></configGdbScript>
-      <runShellScript></runShellScript>
-      <runGdbScript></runGdbScript>
+      <configGdbScript/>
+      <runShellScript/>
+      <runGdbScript/>
     </general>
     <display>
       <staticmembers>false</staticmembers>
@@ -259,10 +259,10 @@
   </kdevcvs>
   <kdevfilecreate>
     <filetypes>
-      <type icon="" ext="h" name="C++ header" create="template" >
+      <type icon="" ext="h" create="template" name="C++ header" >
         <descr>Quanta speicfic header</descr>
       </type>
-      <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>
       </type>
     </filetypes>
@@ -298,7 +298,7 @@
     </codecompletion>
     <references/>
     <creategettersetter>
-      <prefixGet></prefixGet>
+      <prefixGet/>
       <prefixSet>set</prefixSet>
       <prefixVariable>m_,_</prefixVariable>
       <parameterName>theValue</parameterName>
--- 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
Hi...

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

Markus