FileProvider
FileProvider copied to clipboard
WedDavFileProvider. No check error: "A server with the specified hostname could not be found".
I have this little code to upload the media and test it with an incorrect URL rather than the exact one: https://webdav.pcloud.com
.
webdav?.create(folder: folder, at: "/", completionHandler: { (error) in
if let error = error as? URLError {
print("URLError: \(error.errorCode)")
return
}
if let error = error as? FileProviderHTTPError {
switch error.code {
case .methodNotAllowed:
print("ERROR: \(error.code) - The folder: \(folder) exits.")
break
default:
print("ERROR: \(error.code)")
return
}
}
self.webdav?.writeContents(path: remotePath, contents: contents, atomically: true, overwrite: true, completionHandler: { (error) in
if let error = error as? FileProviderHTTPError {
print("ERROR: \(error.description)")
return
}
print("Upload media: \(nameMedia) with eventual creation of the folder, if it does not exist")
})
})
if I use this incorrect url: https://webdav.pcloud
, I get this correct result:
URLError: -1003
.
if I use this incorrect url: https://pcloud.com
, I get this incorrect result from procedure:
Upload media: Milano.jpg with eventual creation of the folder, if it does not exist
,
but from delegate fileproviderFailed
I get this correct results:
From fileproviderFailed Error: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost."
if I use this incorrect url: webdav.pcloud.com
, the procedure goes the loop without providing any error.
Why? Can you help me please? I hope I made myself clear. Thank you in advance.
From what you explained I think you have encountered a bug. I'm working on it.
I'll wait for news. Thank you.