FileProvider icon indicating copy to clipboard operation
FileProvider copied to clipboard

WebDAV Download Override File

Open Dirk23 opened this issue 4 years ago • 3 comments

Hello,

I would like to include WebDAV as an alternative to Dropbox in my project. What my app does is upload and download a file. I copied the demo code and now I'm trying it out a bit. I noticed that the first time I downloaded the file from my WebDAV server, I had no problems saving it to the iPhone, but the next download fails, probably because the local file is not overwritten. Here the message from the simulator:

Downloading kb_daten.sqlite to kb_daten.sqlite: 34.594597 completed.
Downloading kb_daten.sqlite to kb_daten.sqlite: 69.18919 completed.
Downloading kb_daten.sqlite to kb_daten.sqlite: 100.0 completed.
copying kb_daten.sqlite to file:///Users/dirk/Library/Developer/CoreSimulator/Devices/A54B2D35-83C6-4A3E-9D29-BD2419BBBCED/data/Containers/Data/Application/1C8379E3-3EC9-426A-A0A3-BB2F6418D62E/Documents/kb_daten.sqlite has been failed.

I have seen that there is an "override: true", but not with the function used in the example. Here is the code the example uses and comments out the code that overwrites the file:

let progress = webdav?.copyItem(path: remotePath, toLocalURL: localURL, completionHandler: nil)
// let progress = webdav?.copyItem(path: remotePath, to: localURL.absoluteString, overwrite: true, completionHandler: nil)

Unfortunately the progress does not seem to work with the variant that overwrites the file.

How can I download a file, overwrite the local file and still get a progress?

Dirk23 avatar Apr 02 '20 08:04 Dirk23

I tried to add override: true but when doing this, I get a errormessage: Bildschirmfoto 2020-04-02 um 10 28 31

Dirk23 avatar Apr 02 '20 08:04 Dirk23

Is there no way to download a file from Webdav to a iOS Device and override the existing File?

Dirk23 avatar Apr 20 '20 12:04 Dirk23

Same problem here. I ended by removing the actual file (if already existing), at path "localURL" with // remove actual temp file do { try FileManager.default.removeItem(at: localURL) } catch let error as NSError { print("Error: \(error.domain)") }

magicyoda avatar May 07 '20 14:05 magicyoda