Skip to content

Commit

Permalink
Fixed issue when trying to store key files for drafted documents
Browse files Browse the repository at this point in the history
  • Loading branch information
mstarke committed May 24, 2022
1 parent 8be69ca commit cbb4cea
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion MacPass/MPDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -969,11 +969,17 @@ - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)anItem {
}

- (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) {
Expand Down

0 comments on commit cbb4cea

Please sign in to comment.