Skip to content

Critical fixes in handling resolving cryptomator v7 folder uuid, and 2 other minor changes. #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions RemoteCloud/RemoteCloud/FileCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ public class FileCache {
defer {
group.leave()
}

// Fix CoreData merge conflict shows managed object version change not data
context.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy

let fetchrequest = NSFetchRequest<NSFetchRequestResult>(entityName: "FileCacheItem")
fetchrequest.predicate = NSPredicate(format: "storage == %@ && id == %@ && chunkOffset == %lld", storage, id, offset)
do{
Expand Down
5 changes: 5 additions & 0 deletions RemoteCloud/RemoteCloud/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
Expand Down
282 changes: 229 additions & 53 deletions RemoteCloud/RemoteCloud/Storages/Cryptomator.swift

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions RemoteCloud/RemoteCloud/Storages/WebDAVStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ public class WebDAVStorage: NetworkStorage, URLSessionTaskDelegate, URLSessionDa
super.logout()
}

/* Generate RemoteData item from WebDAV records */
func storeItem(item: [String: Any], parentFileId: String? = nil, parentPath: String? = nil, context: NSManagedObjectContext) {
let formatter = DateFormatter()
formatter.locale = Locale(identifier: "en_US_POSIX")
Expand Down Expand Up @@ -579,6 +580,7 @@ public class WebDAVStorage: NetworkStorage, URLSessionTaskDelegate, URLSessionDa

let fetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "RemoteData")
fetchRequest.predicate = NSPredicate(format: "id == %@ && storage == %@", id, self.storageName ?? "")

if let result = try? context.fetch(fetchRequest) {
for object in result {
if let item = object as? RemoteData {
Expand Down Expand Up @@ -625,13 +627,13 @@ public class WebDAVStorage: NetworkStorage, URLSessionTaskDelegate, URLSessionDa
var prop: [String: String] = [:]

func parserDidStartDocument(_ parser: XMLParser) {
print("parser Start")
//os_log("%{public}@", log: OSLog.default, type: .debug, "parser Start")
}

func parser(_ parser: XMLParser, didStartElement elementName: String, namespaceURI: String?, qualifiedName qName: String?, attributes attributeDict: [String : String] = [:]) {
switch elementName {
case let str where str.hasSuffix(":multistatus"):
print("start")
// case let str where str.hasSuffix(":multistatus"):
//os_log("%{public}@", log: OSLog.default, type: .debug, "start")
case let str where str.hasSuffix(":response"):
response.append([:])
case let str where str.hasSuffix(":propstat"):
Expand Down Expand Up @@ -676,8 +678,8 @@ public class WebDAVStorage: NetworkStorage, URLSessionTaskDelegate, URLSessionDa

func parser(_ parser: XMLParser, didEndElement elementName: String, namespaceURI: String?, qualifiedName qName: String?) {
switch elementName {
case let str where str.hasSuffix(":multistatus"):
print("end")
// case let str where str.hasSuffix(":multistatus"):
// os_log("%{public}@", log: OSLog.default, type: .debug, "end")
case let str where str.hasSuffix(":propstat"):
response[response.count-1]["propstat"] = curProp
case let str where str.hasSuffix(":prop"):
Expand All @@ -689,7 +691,7 @@ public class WebDAVStorage: NetworkStorage, URLSessionTaskDelegate, URLSessionDa
}

func parserDidEndDocument(_ parser: XMLParser) {
print("parser End")
//os_log("%{public}@", log: OSLog.default, type: .debug, "parser End")
onFinish?(response)
}

Expand Down Expand Up @@ -794,6 +796,8 @@ public class WebDAVStorage: NetworkStorage, URLSessionTaskDelegate, URLSessionDa
listFolder(path: fileId) { result in
if let items = result {
let backgroundContext = CloudFactory.shared.data.persistentContainer.newBackgroundContext()
let itemcount = items.count
os_log("%{public}@", log: self.log, type: .debug, "store \(itemcount) items(WebDAV:\(self.storageName ?? "") \(fileId)")
for item in items {
self.storeItem(item: item, parentFileId: fileId, parentPath: path, context: backgroundContext)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="14490.98" systemVersion="18E226" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="17709" systemVersion="19H2" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="Mark" representedClassName="Mark" syncable="YES" codeGenerationType="class">
<attribute name="id" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="parent" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="position" optional="YES" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES" syncable="YES"/>
<attribute name="storage" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="id" optional="YES" attributeType="String"/>
<attribute name="parent" optional="YES" attributeType="String"/>
<attribute name="position" optional="YES" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES"/>
<attribute name="storage" optional="YES" attributeType="String"/>
</entity>
<entity name="PlayList" representedClassName="PlayList" syncable="YES" codeGenerationType="class">
<attribute name="folder" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="id" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="index" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
<attribute name="serial" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
<attribute name="storage" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="folder" optional="YES" attributeType="String"/>
<attribute name="id" optional="YES" attributeType="String"/>
<attribute name="index" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="serial" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="storage" optional="YES" attributeType="String"/>
</entity>
<entity name="RemoteData" representedClassName="RemoteData" syncable="YES" codeGenerationType="class">
<attribute name="cdate" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
<attribute name="ext" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="folder" optional="YES" attributeType="Boolean" usesScalarValueType="YES" syncable="YES"/>
<attribute name="hashstr" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="id" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="mdate" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="parent" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="path" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="size" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
<attribute name="storage" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="subend" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
<attribute name="subid" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="subinfo" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="substart" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
<attribute name="cdate" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="ext" optional="YES" attributeType="String"/>
<attribute name="folder" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
<attribute name="hashstr" optional="YES" attributeType="String"/>
<attribute name="id" optional="YES" attributeType="String"/>
<attribute name="mdate" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="name" optional="YES" attributeType="String"/>
<attribute name="parent" optional="YES" attributeType="String"/>
<attribute name="path" optional="YES" attributeType="String"/>
<attribute name="size" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="storage" optional="YES" attributeType="String"/>
<attribute name="subend" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="subid" optional="YES" attributeType="String"/>
<attribute name="subinfo" optional="YES" attributeType="String"/>
<attribute name="substart" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<fetchIndex name="byPropertyIndex">
<fetchIndexElement property="id" type="Binary" order="ascending"/>
</fetchIndex>
</entity>
<fetchRequest name="fetchByIDAndStorage" entity="RemoteData" predicateString="storage == $STORAGE AND id == $ID"/>
<fetchRequest name="FetchNO" entity="RemoteData" predicateString="storage CONTAINS &quot;V7&quot;"/>
<elements>
<element name="Mark" positionX="-63" positionY="54" width="128" height="105"/>
<element name="PlayList" positionX="-63" positionY="99" width="128" height="120"/>
<element name="RemoteData" positionX="-63" positionY="-18" width="128" height="270"/>
<element name="RemoteData" positionX="-63" positionY="-18" width="128" height="268"/>
</elements>
</model>
Loading