Bug 484671

Summary: WebDAV shared files all show "Jan 1 1970" as modification time since 6.0 upgrade
Product: [Frameworks and Libraries] frameworks-kio Reporter: Jens <jens-bugs.kde.org>
Component: WebDAVAssignee: KIO Bugs <kio-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: code-bugs, fabian, kdelibs-bugs, kfm-devel, nate
Priority: NOR    
Version: 6.0.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: Frameworks 6.2
Sentry Crash Report:

Description Jens 2024-03-28 16:22:56 UTC
SUMMARY
I have a Nextcloud 28 instance running to share files with other people.
I have a shortcut in my Dolphin sidebar to use the Files area of this instance shared using WebDAVs:
webdavs://HOSTNAME/remote.php/dav/files/MY_EMAIL/

Since upgrading to KDE 6, all files I can see on this share have the modification time "Jan 1, 1970".
This also happens when using `kioclient ls <URL>` on the command line:

```
$ kioclient stat webdavs://....../Documents/xxxxxx.xls
NAME                  xxxxxx.xls
SIZE                  471552
FILE_TYPE             0100000
MIME_TYPE             application/vnd.ms-excel
ACCESS                0600
MODIFICATION_TIME     Thu Jan 1 00:00:00 1970
CREATION_TIME         Sun Mar 24 13:08:26 2024
```

Using other WebDAV clients (e.g. `cadaver` display the modification time correctly.
This also does not happen wit other remote protocols, e.g. `kio_fish`.

It sesms to be a regression when moving from KDE 5 to KDE 6.



SOFTWARE/OS VERSIONS: KDE Neon 22.04 with all updates applied.
Comment 1 Ben 2024-03-29 15:39:21 UTC
Same on openSUSE Tumbleweed

A curl PROPFIND confirms that the WebDAV server correctly reports <d:getlastmodified> tags.

> [ben@skylab:~]% kioclient stat webdavs://myserver.domain/remote.php/dav/files/myuser/Docs
> NAME                  Docs
> FILE_TYPE             0040000
> ACCESS                0700
> MODIFICATION_TIME     Thu Jan 1 00:00:00 1970
> CREATION_TIME         Thu Jan 1 01:00:00 1970
> [ben@skylab:~]% kioclient stat webdavs://myserver.domain/remote.php/dav/files/myuser/Docs/myfile.pdf
> NAME                  myfile.pdf
> SIZE                  23199
> FILE_TYPE             0100000
> MIME_TYPE             application/pdf
> ACCESS                0600
> MODIFICATION_TIME     Thu Jan 1 00:00:00 1970
> CREATION_TIME         Thu Jan 1 01:00:00 1970
> [ben@skylab:~]% curl -s -u myuser:myapppass -X PROPFIND https://myserver.domain/remote.php/dav/files/myuser/Docs/myfile.pdf | xmlformat
> <?xml version="1.0"?>
> <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
>  <d:response>
>   <d:href>/remote.php/dav/files/myuser/Docs/myfile.pdf</d:href>
>   <d:propstat>
>    <d:prop>
>     <d:getlastmodified>Mon, 04 Dec 2023 20:55:42 GMT</d:getlastmodified>
>     <d:getcontentlength>23199</d:getcontentlength>
>     <d:resourcetype/>
>     <d:getetag>&quot;c9bfb90c5430b5bc2883b21527045dac&quot;</d:getetag>
>     <d:getcontenttype>application/pdf</d:getcontenttype>
>    </d:prop>
>    <d:status>HTTP/1.1 200 OK</d:status>
>   </d:propstat>
>  </d:response>
> </d:multistatus>
> 

A cross check with a smb:// url show fine:

[ben@skylab:~]% kioclient stat smb://mysambaserv/ben 
> NAME                  ben
> SIZE                  0
> FILE_TYPE             0040000
> MODIFICATION_TIME     Fri Mar 22 20:17:44 2024
> ACCESS_TIME           Sat Mar 23 16:43:54 2024

> Information for package kio-core:
> ---------------------------------
> Repository     : Haupt-Repository (OSS)
> Name           : kio-core
> Version        : 5.115.0-1.1
> Arch           : x86_64
> Vendor         : openSUSE
> Installed Size : 2.7 MiB
> Installed      : Yes
> Status         : up-to-date
> Source package : kio-5.115.0-1.1.src
> Upstream URL   : https://www.kde.org
> Summary        : Network transparent access to files and data
> Description    : 
>     This framework implements almost all the file management functions you
>     will ever need. In fact, the KDE file manager (Dolphin) and the KDE
>     file dialog also uses this to provide its network-enabled file management.
>     KIO core libraries, ioslave and daemons.
>
Comment 2 Bug Janitor Service 2024-04-06 16:23:54 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1606
Comment 3 Fabian Vogt 2024-04-06 16:24:47 UTC
Bug in Qt: https://bugreports.qt.io/browse/QTBUG-114681

I opened a MR with a workaround.
Comment 4 Fabian Vogt 2024-04-07 11:16:18 UTC
Git commit a4d7b335d61e32993c90fa1a6ee143b860219f4f by Fabian Vogt.
Committed on 07/04/2024 at 11:15.
Pushed by fvogt into branch 'master'.

http: Fix parsing DAV:getlastmodified

It's defined as a rfc1123 date which always has a "GMT" suffix (which means
UTC). The Qt::RFC2822Date parser in Qt no longer accepts timezones declared
as obsolete in RFC2822, even though that RFC says it MUST be accepted...

Also add some error handling to avoid spitting out invalid UDS values.

M  +21   -6    src/kioworkers/http/http.cpp

https://invent.kde.org/frameworks/kio/-/commit/a4d7b335d61e32993c90fa1a6ee143b860219f4f