FileProvider icon indicating copy to clipboard operation
FileProvider copied to clipboard

I cannot create a file with writeContents

Open uguraltinsoy opened this issue 6 months ago • 0 comments

func creatingFile(_ name:String, _ mime_type:String = "txt", completion: @escaping () -> Void) {
        guard let documentsProvider = WebDAVFileProvider(baseURL: URL(string: server.host)!, credential: credential) else { return }
        let filePath = "\(path)/\(name).\(mime_type)"
        documentsProvider.writeContents(path: filePath, contents: nil, atomically: true, overwrite: false, completionHandler: { error in
            guard error == nil else { return }
            completion()
        })
    }

I get the following error in the console and completionHandler does not work at all, I do not get an error message

The request of a upload task should not contain a body or a body stream, use `upload(for:fromFile:)`, `upload(for:from:)`, or supply the body stream through the `urlSession(_:needNewBodyStreamForTask:)` delegate method.

uguraltinsoy avatar Aug 01 '24 10:08 uguraltinsoy