Closed fsrechia closed 6 years ago
@fsrechia - thanks for noticing. Would you be able to provide a PR that fixes the issue for you? Supporting customized content packs isn't a big priority for us, but a fix is definitely welcomed and will be merged :)
@benjaoming alright, I'll try to do that. thanks!
Tested this with a content pack that had both a "subtitles/" folder and a "subtitles" file in the zip root. It works -- and also still works when there isn't a mysterious "subtitle" file :)
Summary
Extraction of subtitles from content packs might fail depending on zip file folder structure. If the folder
subtitles/
itself is listed as a file inside the zip file, loading the content pack fails withIOError: [Errno 21] Is a directory: '/home/positivo/.kalite/content/srt/pt_BR/subtitles/'
System information
Traceback
The following error happens when trying to load a custom content pack into kalite
How to reproduce
how to fix it:
Depending on the program used to create the content pack, the subtitles folder is listed as a file itself.
Therefore, retrievecontentpack.py line 220 fails, as it resolves the destination filename to a directory (because
subtitle_filename
is empty).I suggest inserting this snippet right after retrievecontentpack.py line 215 to ignore empty filenames:
This is what I did in my local kalite installation and it worked -- I managed to install my custom content pack with additional translations (still not released as a content pack).
Real-life consequences
This issue makes things harder for users trying to update their own content packs, as not all zip tools will omit directories as a file...