manuskript icon indicating copy to clipboard operation
manuskript copied to clipboard

Improve file selection on import dialog

Open FastusNumen opened this issue 1 year ago • 2 comments

The issue came about when I was importing a file. I had a few .odt files to import with Pandoc and for one of those I accidentally forgot to specify the format, so it was left as Markdown. When the window to choose the file opened, instead of only showing .md and .txt files, it showed all formats, and when I clicked on a .odt and tried to open it, the program crashed.

OS: Windows 11 Manuskript version: 0.15.0

Log: 2023-09-11 14:19:28,107 - manuskript.logging - CRITICAL - An unhandled exception has occurred! Traceback (most recent call last): File "manuskript\ui\importers\importer.py", line 133, in selectFile File "manuskript\ui\importers\importer.py", line 239, in preview File "manuskript\ui\importers\importer.py", line 295, in startImport File "manuskript\importer\markdownImporter.py", line 69, in startImport File "codecs.py", line 322, in decode UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8e in position 10: invalid start byte

FastusNumen avatar Sep 13 '23 08:09 FastusNumen

Well it seems like you tried to import a Markdown file but selected an OpenDocument file. Beware the import dialog shows the currently selected format on the upper left before you select any file via the file dialog. I agree that the file dialog should filter files depending on that format. Also it would be better to not crash the application on wrong file selection.

But otherwise this seems to be user error. If you have Pandoc installed, you should be able to select ODT as format before selecting an .odt file for import. Hope this helps.

TheJackiMonster avatar Dec 07 '23 14:12 TheJackiMonster

Yes, I knew that. I thought it was better to remove the option to choose files from different formats though, since mistakes happen. Thanks for the explanation anyway.

FastusNumen avatar Dec 07 '23 22:12 FastusNumen