Skip to content

Commit

Permalink
Merge branch 'release/1.7.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
tobihagemann committed Feb 2, 2023
2 parents d7da92b + 3dcd20f commit e4618d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public class GoogleDriveCloudProvider: CloudProvider {
let query = GTLRDriveQuery_FilesList.query()
query.supportsAllDrives = true
query.includeItemsFromAllDrives = true
query.q = "'\(resolvedParentItemIdentifier)' in parents and name contains '\(name)' and trashed = false"
query.q = "'\(resolvedParentItemIdentifier)' in parents and name contains '\(escapedQueryValue(name))' and trashed = false"
query.fields = "files(id,name,mimeType,shortcutDetails)"
return executeQuery(query).then { result -> GoogleDriveItem in
CloudAccessDDLogDebug("GoogleDriveCloudProvider: getGoogleDriveItem(name: \(name), parentItem: \(parentItem.identifier)) received result: \((result as? GTLRObject)?.jsonString() ?? result)")
Expand Down Expand Up @@ -603,4 +603,8 @@ public class GoogleDriveCloudProvider: CloudProvider {
let rhsWithoutItemName = rhs.deletingLastPathComponent()
return lhsWithoutItemName == rhsWithoutItemName
}

func escapedQueryValue(_ value: String) -> String {
return value.replacingOccurrences(of: "'", with: "\\'")
}
}
8 changes: 6 additions & 2 deletions Sources/CryptomatorCloudAccess/WebDAV/WebDAVSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ class WebDAVSession {
let pendingPromise = Promise<HTTPURLResponse>.pending()
let webDAVDownloadTask = WebDAVDownloadTask(promise: pendingPromise, localURL: localURL)
delegate?.addRunningDownloadTask(key: task, value: webDAVDownloadTask)
task.resume()
if onTaskCreation == nil {
task.resume()
}
return pendingPromise.then { response -> Promise<HTTPURLResponse> in
HTTPDebugLogger.logResponse(response, with: nil, or: localURL)
return Promise(response)
Expand All @@ -242,7 +244,9 @@ class WebDAVSession {
let pendingPromise = Promise<(HTTPURLResponse, Data?)>.pending()
let webDAVDataTask = WebDAVDataTask(promise: pendingPromise)
delegate?.addRunningDataTask(key: task, value: webDAVDataTask)
task.resume()
if onTaskCreation == nil {
task.resume()
}
return pendingPromise.then { response, data -> Promise<(HTTPURLResponse, Data?)> in
HTTPDebugLogger.logResponse(response, with: data, or: nil)
return Promise((response, data))
Expand Down

0 comments on commit e4618d8

Please sign in to comment.