Fix Mnemosyne importer clobbering source file

This commit is contained in:
Damien Elmes 2024-05-17 12:33:09 +07:00
parent 7a1508adb7
commit bc69f689ab

View file

@ -96,7 +96,7 @@ class MnemosyneImporter(Importer):
@staticmethod
def do_import(mw: aqt.main.AnkiQt, path: str) -> None:
def on_success(json: str) -> None:
json_path = os.path.join(tmpdir(), path)
json_path = os.path.join(tmpdir(), os.path.basename(path))
with open(json_path, "wb") as file:
file.write(json.encode("utf8"))
ImportDialog(mw, JsonFileArgs(path=json_path))