diff --git a/Cartfile b/Cartfile index e72aa64d..59470bce 100644 --- a/Cartfile +++ b/Cartfile @@ -1,3 +1,3 @@ github "sparkle-project/Sparkle" ~> 1.18.1 -github "MacPass/KeePassKit" ~> 1.8 +github "MacPass/KeePassKit" ~> 1.9 github "mstarke/HNHUi" ~> 1.4.1 diff --git a/Cartfile.resolved b/Cartfile.resolved index 7acc5cfd..a4535702 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,3 +1,3 @@ -github "MacPass/KeePassKit" "1.8" +github "MacPass/KeePassKit" "1.9" github "mstarke/HNHUi" "1.4.1" github "sparkle-project/Sparkle" "1.18.1" diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index 9988b04b..3fd9b4a4 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -417,7 +417,12 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou for(NSWindow *sheet in [self windowForSheet].sheets) { [[self windowForSheet] endSheet:sheet]; } - [self saveDocumentWithDelegate:self didSaveSelector:@selector(_lockDatabaseForDocument:didSave:contextInfo:) contextInfo:NULL]; + if(self.documentEdited) { + [self saveDocumentWithDelegate:self didSaveSelector:@selector(_lockDatabaseForDocument:didSave:contextInfo:) contextInfo:NULL]; + } + else { + [self _lockDatabaseForDocument:self didSave:YES contextInfo:NULL]; + } } } @@ -433,8 +438,8 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou [self exitSearch:self]; [self.undoManager removeAllActions]; NSError *error; - /* TODO let the tree chose the encryption */ - self.encryptedData = [self.tree encryptWithKey:self.compositeKey format:[MPDocument formatForFileType:self.fileType] error:&error]; + /* use data from disk since we wrote it*/ + self.encryptedData = [NSData dataWithContentsOfURL:self.fileURL options:NSDataReadingUncached error:&error]; if(nil == self.encryptedData && error ) { [self presentError:error]; return;