Probable fix for # 55 (OneDrive url issue)

This commit is contained in:
Amir Abbas
2017-07-31 20:10:40 +04:30
parent 41e266c2a9
commit fd9d4c1ab4
3 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ public final class LocalFileObject: FileObject {
var fileURL: URL?
var rpath = path.replacingOccurrences(of: relativeURL?.path ?? "", with: "", options: .anchored)
if relativeURL != nil && rpath.hasPrefix("/") {
rpath.remove(at: rpath.startIndex)
_=rpath.characters.removeFirst()
}
if #available(iOS 9.0, macOS 10.11, tvOS 9.0, *) {
fileURL = URL(fileURLWithPath: rpath, relativeTo: relativeURL)
+6 -5
View File
@@ -213,16 +213,18 @@ open class OneDriveFileProvider: FileProviderBasicRemote {
rpath = self.currentPath
}
let driveURL = baseURL!.appendingPathComponent("drive/\(drive):/")
if rpath.hasPrefix("/") {
rpath.remove(at: rpath.startIndex)
_=rpath.characters.removeFirst()
}
if rpath.isEmpty {
if let modifier = modifier {
return baseURL!.appendingPathComponent("drive/\(drive)/\(modifier)")
return driveURL.appendingPathComponent(modifier)
}
return baseURL!.appendingPathComponent("drive/\(drive)")
return driveURL
}
let driveURL = baseURL!.appendingPathComponent("drive/\(drive):/")
rpath = (rpath.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? rpath)
rpath = rpath.trimmingCharacters(in: pathTrimSet)
if let modifier = modifier {
@@ -247,7 +249,6 @@ open class OneDriveFileProvider: FileProviderBasicRemote {
extension OneDriveFileProvider: FileProviderOperations {
open func create(folder folderName: String, at atPath: String, completionHandler: SimpleCompletionHandler) -> OperationHandle? {
let path = (atPath as NSString).appendingPathComponent(folderName) + "/"
return doOperation(.create(path: path), completionHandler: completionHandler)
+1 -1
View File
@@ -20,7 +20,7 @@ public final class OneDriveFileObject: FileObject {
internal init(baseURL: URL?, name: String, path: String) {
var rpath = path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? path
if rpath.hasPrefix("/") {
rpath.remove(at: rpath.startIndex)
_=rpath.characters.removeFirst()
}
let url = URL(string: rpath, relativeTo: baseURL) ?? URL(string: rpath)!
super.init(url: url, name: name, path: path)