Fixed issue when trying to store key files for drafted documents

This commit is contained in:
Michael Starke
2022-05-24 11:46:17 +02:00
parent 8be69ca779
commit cbb4cea9cf

View File

@@ -969,11 +969,17 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
}
- (void)_storeKeyURL:(NSURL *)keyURL {
if(self.isDraft) {
// we cannot store key files for draft documents
return;
}
NSMutableDictionary *keysForFiles = [[NSUserDefaults.standardUserDefaults dictionaryForKey:kMPSettingsKeyRememeberdKeysForDatabases] mutableCopy];
MPAppDelegate *delegate = (MPAppDelegate *)[NSApp delegate];
if(!delegate.isAllowedToStoreKeyFile || nil == keyURL) {
/* user has removed the keyfile or we should not safe it so remove it */
[keysForFiles removeObjectForKey:self.fileURL.path.sha1HexDigest];
if(self.fileURL) {
[keysForFiles removeObjectForKey:self.fileURL.path.sha1HexDigest];
}
}
else if([self.compositeKey hasKeyOfClass:KPKPasswordKey.class] && [self.compositeKey hasKeyOfClass:KPKFileKey.class]) {
if(nil == keysForFiles) {