diff --git a/MacPass/MPAutotypeContext.h b/MacPass/MPAutotypeContext.h index 3cf95711..c4ffbf98 100644 --- a/MacPass/MPAutotypeContext.h +++ b/MacPass/MPAutotypeContext.h @@ -41,11 +41,16 @@ @property (nonatomic, readonly, copy) NSString *command; @property (nonatomic, readonly, copy) NSString *normalizedCommand; /** - * Command with placeholders and references resolved + * Command with placeholders and references resolved. + * This will evaluate any placeholder regardless of side-effects. + * If you need to evaluat the command without interaction, you should call kpk_finalValueForEntry:options: directly on the normalizedCommand. */ @property (nonatomic, readonly, copy) NSString *evaluatedCommand; /** - @return command with placeholders and references resolved but masked password placeholder + @return command with placeholders and references resolved but masked password placeholder. + + This will call kpk_finalValueForEntry:options on the normalizedCommand with options set to KPKCommandEvaluationOptionSkipUserInteraction and KPKCommandEvaluationOptionReadOnly. + This way it is ensured that the value can be used in UI without any intereference or data changes! */ @property (nonatomic, readonly, copy) NSString *maskedEvaluatedCommand; /** diff --git a/MacPass/MPAutotypeContext.m b/MacPass/MPAutotypeContext.m index 278914ab..4ba866b4 100644 --- a/MacPass/MPAutotypeContext.m +++ b/MacPass/MPAutotypeContext.m @@ -86,7 +86,7 @@ NSString *passwordPlaceholder = [NSString stringWithFormat:@"{%@}",kKPKPasswordKey]; NSString *normalized = self.normalizedCommand; NSString *masked = [normalized stringByReplacingOccurrencesOfString:passwordPlaceholder withString:@"•••" options:NSCaseInsensitiveSearch range:NSMakeRange(0, normalized.length)]; - return [[masked kpk_finalValueForEntry:self.entry] copy]; + return [[masked kpk_finalValueForEntry:self.entry options:KPKCommandEvaluationOptionSkipUserInteraction|KPKCommandEvaluationOptionReadOnly] copy]; } - (NSString *)description {