Bug 460717

Summary: Regression: Copying files into WebDAV folder stores protocol xml instead of actual file contents
Product: [Frameworks and Libraries] frameworks-kio Reporter: Jan <medhefgo>
Component: WebDAVAssignee: KIO Bugs <kio-bugs-null>
Status: RESOLVED FIXED    
Severity: major CC: code-bugs, kde, kdelibs-bugs, nevermind942, sitter
Priority: NOR    
Version: 5.99.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Jan 2022-10-19 16:49:19 UTC
Copying a file into a WebDAV folder is successful, but creates a xml file that seems to contain some WebDAV protocol xml data instead of the expected file contents itself:

> <?xml version="1.0" encoding="utf-8" ?><D:propfind xmlns:D="DAV:"><D:prop><D:creationdate/><D:getcontentlength/><D:displayname/><D:resourcetype/></D:prop></D:propfind>

ed1a8a529f12c8a239877b8e68e2fdd12c991590 is the first bad commit
commit ed1a8a529f12c8a239877b8e68e2fdd12c991590
Author: Harald Sitter <sitter@kde.org>
Date:   Fri Sep 2 13:21:10 2022 +0200

    port http to workerbase
    
    the scariest port yet!
    
    this introduces an unfortunate direct copy of tcpslavebase as
    tcpworkerbase.
    
    other than that it is a fairly straight forward port to workerbase and
    workerresult, albeit in very complicated code.
    
    workerbase gained an additional setIncomingMetaData function that
    replaces the previous direct access of mIncomingMetaData (that is no
    longer possible because the member lives on the bridged slavebase inside
    the workerbase)
Comment 1 Harald Sitter 2022-10-20 10:53:50 UTC
We'll need more info than that. The relevant unit test seems to copy just fine.

What's the step by step procedure to trigger this? What server and client versions are involved?
Comment 2 Jan 2022-10-20 11:10:54 UTC
Do the unit tests actually test webdav or just http?

This happens on different servers for me. Easiest way to reproduce (using rclone as server):
 $ rclone serve webdav /tmp/ &
 $ kioclient copy /usr/lib/os-release webdav://localhost:8080/
 $ kioclient copy /usr/lib/os-release http://localhost:8080/os-release-http
 $ sha1sum /tmp/os-release /tmp/os-release-http /usr/lib/os-release 
 8b28a71fbf6503d1890dc2434425feeae9febdab  /tmp/os-release
 77226c8499c5be5bb623b4eebf93bdd5ce14c8e7  /tmp/os-release-http
 77226c8499c5be5bb623b4eebf93bdd5ce14c8e7  /usr/lib/os-release

rclone v1.59.2
kio 5.99.0-1
kioclient 5.26.0
Comment 3 Harald Sitter 2022-10-20 12:52:01 UTC
https://invent.kde.org/frameworks/kio/-/merge_requests/1008 should possibly fix the problem
Comment 4 slt 2022-10-21 08:12:33 UTC
https://bugs.kde.org/show_bug.cgi?id=460582 is a duplicate, I am not sure if I should copy the relevant information here.
STEPS TO REPRODUCE
1. Use Dolphin to open webdavs://username@some.example.com:443/testfolder/
2. Copy a file testfile.txt to the share

The server version for me is apache 2.4.41 over nginx 1.18.0 reverse proxy (ubuntu 20.04)
The client is (arch linux) kde plasma 5.26.0, kde frameworks 5.99.0, qt 5.15.6
The connection is over https. Reverting only kio to 5.98 in the same environment does not produce this bug, so it was introduced in kio 5.99
Comment 5 Ben 2022-10-27 10:22:11 UTC
(In reply to Harald Sitter from comment #3)
> https://invent.kde.org/frameworks/kio/-/merge_requests/1008 should possibly
> fix the problem

Why are you hiding a bug fix in a merge request titled "don't disable tests..."?
Comment 6 Ben 2022-10-27 10:49:42 UTC
*** Bug 460582 has been marked as a duplicate of this bug. ***
Comment 7 Ben 2022-10-27 10:52:43 UTC
I can confirm that commit 501091059ae9fc2877d621cdbc0fb3c5ece56dae from merge request !1008 fixes the problem for me on openSUSE Tumbleweed.
Comment 8 Axel Hinrichs 2022-11-17 10:40:08 UTC
Had the same issue on Arch. And I also can confirm that the (In reply to Ben from comment #7)
> I can confirm that commit 501091059ae9fc2877d621cdbc0fb3c5ece56dae from
> merge request !1008 fixes the problem for me on openSUSE Tumbleweed.

I also can confirm that this commit fixes it. 

I would upvote the severity of this regression. I lost some files because I moved it to a Webdav folder without any indication that something went wrong. Just to find out later that the content was "replaced" with 167 bytes of xml.
Comment 9 Ben 2022-11-17 10:53:52 UTC
kio 5.100.0 has the commit fixing this