|
@@ -245,7 +245,7 @@ import NCCommunication
|
|
|
|
|
|
//MARK: - WebDav Create Folder
|
|
|
|
|
|
- @objc func createFolder(fileName: String, serverUrl: String, account: String, url: String, completion: @escaping (_ errorCode: Int, _ errorDescription: String)->()) {
|
|
|
+ @objc func createFolder(fileName: String, serverUrl: String, account: String, url: String, overwrite: Bool = false, completion: @escaping (_ errorCode: Int, _ errorDescription: String)->()) {
|
|
|
|
|
|
let isDirectoryEncrypted = CCUtility.isFolderEncrypted(serverUrl, e2eEncrypted: false, account: account)
|
|
|
|
|
@@ -254,15 +254,17 @@ import NCCommunication
|
|
|
NCNetworkingE2EE.shared.createFolder(fileName: fileName, serverUrl: serverUrl, account: account, url: url, completion: completion)
|
|
|
#endif
|
|
|
} else {
|
|
|
- createFolderPlain(fileName: fileName, serverUrl: serverUrl, account: account, url: url, completion: completion)
|
|
|
+ createFolderPlain(fileName: fileName, serverUrl: serverUrl, account: account, url: url, overwrite: overwrite, completion: completion)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @objc func createFolderPlain(fileName: String, serverUrl: String, account: String, url: String, completion: @escaping (_ errorCode: Int, _ errorDescription: String)->()) {
|
|
|
+ @objc func createFolderPlain(fileName: String, serverUrl: String, account: String, url: String, overwrite: Bool, completion: @escaping (_ errorCode: Int, _ errorDescription: String)->()) {
|
|
|
|
|
|
var fileNameFolder = CCUtility.removeForbiddenCharactersServer(fileName)!
|
|
|
|
|
|
- fileNameFolder = NCUtility.sharedInstance.createFileName(fileNameFolder, serverUrl: serverUrl, account: account)
|
|
|
+ if (!overwrite) {
|
|
|
+ fileNameFolder = NCUtility.sharedInstance.createFileName(fileNameFolder, serverUrl: serverUrl, account: account)
|
|
|
+ }
|
|
|
if fileNameFolder.count == 0 {
|
|
|
self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": Int(0)], errorDescription: "", completion: completion)
|
|
|
return
|
|
@@ -284,6 +286,8 @@ import NCCommunication
|
|
|
self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": errorCode], errorDescription: errorDescription, completion: completion)
|
|
|
}
|
|
|
}
|
|
|
+ } else if errorCode == 405 && overwrite {
|
|
|
+ self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": 0], errorDescription: "", completion: completion)
|
|
|
} else {
|
|
|
self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": errorCode], errorDescription: errorDescription, completion: completion)
|
|
|
}
|