From e8fe30ebf7739b84d22488ef6eb07c1ed029cd7c Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Tue, 15 Dec 2015 23:19:19 +0100 Subject: [PATCH] Fix unicode bug with special characters in path names. Decode path before using it in join (Python2 only). --- sigal/settings.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sigal/settings.py b/sigal/settings.py index 68606a1..723000e 100644 --- a/sigal/settings.py +++ b/sigal/settings.py @@ -140,15 +140,14 @@ def read_settings(filename=None): enc = locale.getpreferredencoding() if PY2 else None for p in paths: - path = settings[p] - if path and not isabs(path): - settings[p] = abspath(normpath(join(settings_path, path))) - logger.debug("Rewrite %s : %s -> %s", p, path, settings[p]) - # paths must to be unicode strings so that os.walk will return # unicode dirnames and filenames if PY2 and isinstance(settings[p], str): settings[p] = settings[p].decode(enc) + path = settings[p] + if path and not isabs(path): + settings[p] = abspath(normpath(join(settings_path, path))) + logger.debug("Rewrite %s : %s -> %s", p, path, settings[p]) if settings['title'] and not isinstance(settings['title'], text_type): settings['title'] = settings['title'].decode('utf8')