Review Request 116523: Do not call ftpSendMimeType for empty files in Ftp::ftpGet

Dawit Alemayehu adawit at kde.org
Wed Mar 12 11:29:17 GMT 2014



> On March 4, 2014, 7:42 p.m., David Faure wrote:
> > I don't get it. What's the problem with sending a mimetype for empty files? I would think this is actually expected - for all files, including empty ones. Why does this fix the bug?
> 
> Dawit Alemayehu wrote:
>     It fails and ends up sending an error message. See the if statement in while(true) loop in ftpSendMimeType. Even if that check does not fail and  the while(true) loop completes successfully, the next statement "if (!buffer.isEmpty())" will be false for empty files. Hence it is completely useless to call ftpSendMimeType from ftpGet for empty files.
> 
> Dawit Alemayehu wrote:
>     dfaure: any further questions on this?
> 
> David Faure wrote:
>     I still think this is wrong. By contract the kioslave must emit a mimetype.
>     Instead, ftpSendMimeType should be fixed, to detect the case where totalSize is 0, and skip the loop in that case since we have nothing to read.
>

Ahh... I forgot that the mimeType signal MUST be emitted. But even if we avoid the while loop the if statement also prevents the emission of that signal. What mime-type should be emitted in case of zero sized files would the better question I guess. KMimeType::defaultMimeType()?


- Dawit


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/116523/#review51922
-----------------------------------------------------------


On March 2, 2014, 2:20 p.m., Dawit Alemayehu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/116523/
> -----------------------------------------------------------
> 
> (Updated March 2, 2014, 2:20 p.m.)
> 
> 
> Review request for kdelibs and David Faure.
> 
> 
> Bugs: 323491
>     http://bugs.kde.org/show_bug.cgi?id=323491
> 
> 
> Repository: kdelibs
> 
> 
> Description
> -------
> 
> The attached patch fixes a bug where copying empty files (size == 0) from an ftp server to any other remote server (sftp, ftp) results in an error message that states the file could not be opened.
> 
> 
> Diffs
> -----
> 
>   kioslave/ftp/ftp.cpp 5bb2e8d 
> 
> Diff: https://git.reviewboard.kde.org/r/116523/diff/
> 
> 
> Testing
> -------
> 
> Attempt to copy an empty file from any ftp server to a remote destination, e.g. sftp server.
> 
> 
> Thanks,
> 
> Dawit Alemayehu
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20140312/9b817258/attachment.htm>


More information about the kde-core-devel mailing list