Commit graph

42 commits

Author SHA1 Message Date
Jan Wester 33ac127173 Directory entries in ZIP break loading code
While tackling issue #529, I stumbled across the odd behaviour that
re-compressing the archive with 7-Zip broke what should be a valid
Manuskript project.

After investigation it turned out that the code that loads the texts
sensibly expects there to only be files tracked in the files dictionary.

It is completely valid for a zip file to contain entries describing the
contained directories. The logical fix is to simply avoid adding these
directory entries to our files dictionary in the first place.
2019-03-12 14:44:51 -06:00
Sebastian Rasmussen dfe88a9681 Fix typos in code comments, invisible to end-users. 2018-01-29 10:30:41 -07:00
Curtis Gedak 60cc6c59aa Skip loading directory and file names that begin with a period
See issue #281.

When loading a project that has the setting **Save to one single
file** disabled, Manuskript tries to read all directories and files
under the project directory.

Manuskript expects all files to contain valid unicode characters.

However if a file containing non-unicode characters is read then
Manuskript will crash.

The error message displayed on the console is similar to the
following:

----- begin snippet -----
Traceback (most recent call last):
  File "/home/gedakc/workspace/manuskript.olivierkes/bin/../manuskript/ui/welcome.py", line 134, in loadRecentFile
    self.mw.loadProject(act.data())
  File "/home/gedakc/workspace/manuskript.olivierkes/bin/../manuskript/mainWindow.py", line 566, in loadProject
    self.loadDatas(project)
  File "/home/gedakc/workspace/manuskript.olivierkes/bin/../manuskript/mainWindow.py", line 793, in loadDatas
    errors = loadSave.loadProject(project)
  File "/home/gedakc/workspace/manuskript.olivierkes/bin/../manuskript/loadSave.py", line 66, in loadProject
    v1.loadProject(project, zip=isZip)
  File "/home/gedakc/workspace/manuskript.olivierkes/bin/../manuskript/load_save/version_1.py", line 657, in loadProject
    files[os.path.join(p, f)] = fo.read()
  File "/usr/lib/python3.5/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 3131: invalid start byte
----- end snippet -----

There are at least two known situations in which files with
non-unicode characters can arise:

A. The project is on Mac OS X and the operating system automatically
   creates a .DS_Store file.

B. The project is under git version control and contains a .git
   subdirectory.

This enhancement prevents the Manuskript crash on project load by
ignoring all directory and file names that start with a period.
2018-01-14 11:51:50 -07:00
Olivier Keshavjee cf4c1c83bf Changes every Enum to IntEnum 2017-11-15 21:05:48 +01:00
Olivier Keshavjee 9e95196cc5 Changes Outline enums to IntEnum 2017-11-15 20:58:12 +01:00
Olivier Keshavjee bc0d6f5760 Creates base classes 2017-11-15 20:34:05 +01:00
Olivier Keshavjee fd0cd2cd4f Improves the Mind Map importer #208 2017-11-13 22:55:33 +01:00
Olivier Keshavjee 276559bc04 Fixes a bug in #169: crash when moving around folders with the same name 2017-10-27 12:27:12 +02:00
Olivier Keshavjee c7e6a2d53e Fixes again: Crash when permissions don't allow saving #138 2017-10-15 21:39:36 +02:00
Olivier Keshavjee f2aa9abc85 Fixes: Crash when permissions don't allow saving #138 2017-10-14 12:17:03 +02:00
Curtis Gedak cdcf184c10 Fixes: epiphany section in basic infos for characters not saved #43 2017-05-07 12:57:48 -06:00
Olivier Keshavjee 085a9e4a2d Fixes bug #27, probably 2016-04-18 09:24:17 +02:00
Olivier Keshavjee 6fdfeaf6d0 Bug corrected: old file format type when loading old documents 2016-04-08 13:31:48 +02:00
Olivier Keshavjee 6ac9966ad0 Fixes bug: if not specifing encoding, python open files with OS dependent default codec 2016-04-01 01:00:16 +02:00
Olivier Keshavjee 747f169a2b Corrects bug when saving empty plots 2016-03-31 16:09:37 +02:00
Olivier Keshavjee cf6e021ed1 Minor tweak in file format 2016-03-31 10:49:56 +02:00
Olivier Keshavjee 7e954eab5e Purging types from outlineModel and others 2016-03-30 11:26:31 +02:00
Olivier Keshavjee 54ab5f0455 Purging types from file loader 2016-03-30 11:14:05 +02:00
Olivier Keshavjee e9fcb967f5 Fixes bug in new file format 2016-03-30 10:00:09 +02:00
Olivier Keshavjee 2c0e3074ce Adds: UI setting to change project format (single file, or directory) 2016-03-29 19:13:51 +02:00
Olivier Keshavjee a27e5db6f5 Needs to do the Markdown syntax highlighter now... 2016-03-11 15:45:51 +01:00
Olivier Keshavjee 0cd7c08f1a Bug corrected 2016-03-11 14:56:16 +01:00
Olivier Keshavjee e02c5fe6fe One more bug corrected 2016-03-10 15:35:41 +01:00
Olivier Keshavjee a3f1d11324 Bug corrected 2016-03-10 14:45:42 +01:00
Olivier Keshavjee 482641c7f2 Adds a few FIXME as roadmap 2016-03-10 14:15:03 +01:00
Olivier Keshavjee fa386896db Saving 2.0 works. 2016-03-10 14:11:28 +01:00
Olivier Keshavjee b26de717a9 Seems that loading works 2016-03-10 13:10:31 +01:00
Olivier Keshavjee b2a51e1a09 Reads characters 2016-03-10 11:45:40 +01:00
Olivier Keshavjee ed7e5f69b5 Saves revision even in non-zip format 2016-03-09 17:20:43 +01:00
Olivier Keshavjee fc89207ca8 Saving seems to be done 2016-03-09 16:02:22 +01:00
Olivier Keshavjee b29fbebd25 PEP8 cleaning 2016-03-09 15:54:01 +01:00
Olivier Keshavjee dc1b757770 Saving seems to work kind of smoothly 2016-03-09 15:48:59 +01:00
Olivier Keshavjee da5bfb8951 Removes deleted character's files when saving 2016-03-09 14:10:22 +01:00
Olivier Keshavjee 97903b2781 Never thought it would be so boring to code that part 2016-03-09 13:20:52 +01:00
Olivier Keshavjee 05715a26e0 Writes outline 2016-03-08 09:21:44 +01:00
Olivier Keshavjee c31681a724 Saves plots, correctly. 2016-03-06 16:27:03 +01:00
Olivier Keshavjee 8949d7b8e3 Changes subplots to steps 2016-03-06 16:10:25 +01:00
Olivier Keshavjee 599a60ecff Changes some more 'persos' to 'characters' 2016-03-06 09:26:59 +01:00
Olivier Keshavjee b45a32cfde Saves World Model. Still work in progress, but a step closer. 2016-03-05 17:46:02 +01:00
Olivier Keshavjee 3fd446dd1e Working on backward compatibility 2016-03-05 12:55:56 +01:00
Olivier Keshavjee af089e8a6a Plain text file format in progress 2016-03-05 00:52:11 +01:00
Olivier Keshavjee 1f85ee6171 Working on a more flexible loading/saving system 2016-03-04 22:00:02 +01:00