Retain custom file extension if present and do not change back to .kdbx (or .kdb)

This commit is contained in:
Michael Starke
2019-08-27 14:54:00 +02:00
parent 4cda972d14
commit c0c053d422

View File

@@ -173,6 +173,18 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
return NO;
}
- (NSString *)fileNameExtensionForType:(NSString *)typeName saveOperation:(NSSaveOperationType)saveOperation {
NSString *proposedExtension = [super fileNameExtensionForType:typeName saveOperation:saveOperation];
if(!self.fileURL) {
return proposedExtension;
}
NSString *actualExtension = self.fileURL.pathExtension;
if(![actualExtension isEqualToString:proposedExtension]) {
NSLog(@"Extension missmatch.");
}
return actualExtension;
}
- (NSData *)dataOfType:(NSString *)typeName error:(NSError * _Nullable __autoreleasing *)outError {
if(self.encrypted) {
NSLog(@"%@ should not be called on locked databases!", NSStringFromSelector(_cmd));