From c285feea76fe58ac1fa7bae5536a35cf798005cd Mon Sep 17 00:00:00 2001 From: lthievenaz-keeper Date: Fri, 17 Jul 2026 14:14:14 +0100 Subject: [PATCH 1/2] Add support for no-shortcuts command in import Add flag to fully disable the shortcut handling for the import command. --- keepercommander/importer/commands.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/keepercommander/importer/commands.py b/keepercommander/importer/commands.py index 25a85f743..23245f743 100644 --- a/keepercommander/importer/commands.py +++ b/keepercommander/importer/commands.py @@ -65,6 +65,8 @@ def register_command_info(aliases, command_info): help='default shared folder permissions: manage (U)sers, manage (R)ecords, can (E)dit, can (S)hare, or (A)ll, (N)one') import_parser.add_argument('--update', dest='update_flag', action='store_true', help='update records with common login, url or title') +import_parser.add_argument('--no-shortcuts', dest='no_shortcuts', action='store_true', + help='disable shortcut handling (only new records)') import_parser.add_argument('--users', dest='users_only', action='store_true', help='update shared folder user permissions only') import_parser.add_argument('--record-type', dest='record_type', action='store', From fad86b25baf7f3bb795d641f4d83302f43d89876 Mon Sep 17 00:00:00 2001 From: lthievenaz-keeper Date: Fri, 17 Jul 2026 14:19:31 +0100 Subject: [PATCH 2/2] Add support for no-shortcuts flag Behavior changes: - If the import record is identical to another record in the vault: - without `no-shortcuts`: we create a shortcut - with `--no-shortcuts`: we create a new record --- keepercommander/importer/imp_exp.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/keepercommander/importer/imp_exp.py b/keepercommander/importer/imp_exp.py index 48b29176f..f36c9b068 100644 --- a/keepercommander/importer/imp_exp.py +++ b/keepercommander/importer/imp_exp.py @@ -721,6 +721,7 @@ def _import(params, file_format, filename, **kwargs): if import_into: import_into = import_into.replace(PathDelimiter, 2*PathDelimiter) update_flag = kwargs.get('update_flag') or False + no_shortcuts = kwargs.get('no_shortcuts') or False importer = importer_for_format(file_format)() # type: BaseImporter @@ -883,7 +884,7 @@ def _import(params, file_format, filename, **kwargs): records_v3_to_update = [] # type: List[record_pb2.RecordUpdate] import_uids = {} - records_to_import, record_exists, external_lookup = prepare_record_add_or_update(update_flag, params, records) + records_to_import, record_exists, external_lookup = prepare_record_add_or_update(update_flag, no_shortcuts, params, records) if show_skipped and record_exists: for existing_record in record_exists: folder_name = '' @@ -2063,7 +2064,7 @@ def build_record_hash(tokens): # type: (Iterator[str]) -> str return hasher.hexdigest() -def prepare_record_add_or_update(update_flag, params, records): +def prepare_record_add_or_update(update_flag, no_shortcuts, params, records): # type: (bool, KeeperParams, Iterable[ImportRecord]) -> Tuple[List[ImportRecord], List[ImportRecord], dict] """ Find what records to import or update. @@ -2121,7 +2122,7 @@ def prepare_record_add_or_update(update_flag, params, records): f.value = LARGE_FIELD_MSG.format(atta.name) record_hash = build_record_hash(tokenize_full_import_record(import_record)) - if record_hash in preexisting_entire_record_hash: + if no_shortcuts is False and record_hash in preexisting_entire_record_hash: record_uid = preexisting_entire_record_hash[record_hash] if import_record.uid: external_lookup[import_record.uid] = record_uid