FileProvider icon indicating copy to clipboard operation
FileProvider copied to clipboard

WebDAVFileProvider#writeContents not reconnecting with credentials after 401

Open tladesignz opened this issue 6 years ago • 2 comments

I tried the latest master (9384264d29bc865697560cc45bd919ee8857a4e6) to get rid of the Swift version warnings.

Unfortunately, a regression was introduced: As far as I can understand from my Nextcloud server logs, WebDAVProvider#writeContents doesn't reconnect on HTTP 401 (Unauthorized) with credentials anymore.

This works with last release 0.25.1.

tladesignz avatar Mar 19 '19 16:03 tladesignz

Ok. Today's Xcode update with Swift 5 forced me to use the latest fork I could find.

I tried to work around this by writing a temp file and using #copyItem(localFile:to:completionHandler:). This still breaks. So it must be the content, which is JSON. Somehow this breaks the upload. Sometimes without any error message (just hanging) or with -999:

Task <7F91F278-D7B1-4C00-9A88-22D6BAEF018D>.<1> load failed with error Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://nextcloud.example.com/remote.php/webdav/Test/2019-03-26T15%3A13%3A43GMT+01%3A00/IMG_0005.JPG.meta.json, NSErrorFailingURLKey=https://nextcloud.example.com/remote.php/webdav/Test/2019-03-26T15%3A13%3A43GMT+01%3A00/IMG_0005.JPG.meta.json, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalUploadTask <7F91F278-D7B1-4C00-9A88-22D6BAEF018D>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalUploadTask <7F91F278-D7B1-4C00-9A88-22D6BAEF018D>.<1>, NSLocalizedDescription=cancelled} [-999]
2019-03-26 15:14:19.525753+0100 OpenArchive[9762:148233] Task <7F91F278-D7B1-4C00-9A88-22D6BAEF018D>.<1> finished with error - code: -999
2019-03-26 15:14:19.526516+0100 OpenArchive[9762:148232] Task <7F91F278-D7B1-4C00-9A88-22D6BAEF018D>.<1> HTTP load failed (error code: -999 [1:89])

The next upload, which is an image file, works without problems. As mentioned, the last release works just fine with the JSON content.

What did change?

tladesignz avatar Mar 26 '19 14:03 tladesignz