Probable fix for # 55 (OneDrive url issue)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user