Skip to content
Snippets Groups Projects
Commit fb68d8cd authored by Andreas Domanowski's avatar Andreas Domanowski
Browse files

Proceed import with non-existent history file

parent 9634364b
No related branches found
No related tags found
1 merge request!1Hedgedoc import
This commit is part of merge request !1. Comments created here will be created in the context of that merge request.
......@@ -33,11 +33,19 @@ def import_into_hedgedoc(instance_url, session_id, export_folder, archive_file):
f"Checking existence of archive file ({archive_file})")
check_file_exists(archive_file)
# get exported history map
with open(os.path.join(export_folder, "history.json")) as map_file:
history_json_filename = "history.json"
history_dictionary = {}
try:
with open(os.path.join(export_folder, "%s" % history_json_filename)) as map_file:
history_dictionary = json.load(map_file)
except FileNotFoundError:
print_block_heading(
f"INFO: could not find file {history_json_filename}. Continuing anyways with random generated paths for "
f"documents")
# mapping from title of a document (= filename without md extension in archive) to its id (= note url in CodiMD)
lookup_map = {}
if "history" in history_dictionary:
for entry in history_dictionary["history"]:
lookup_map[entry["text"]] = entry["id"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment