diff options
author | icoz <icoz.vt@gmail.com> | 2015-02-02 22:10:06 +0300 |
---|---|---|
committer | icoz <icoz.vt@gmail.com> | 2015-02-02 22:10:06 +0300 |
commit | 1f30583f3e4e14c84487aecfc3817de32ab42827 (patch) | |
tree | bf3271d207c215d761cfd3bdd7bef51457343045 /habraparse.py | |
parent | eb12979b1fc5f6041db3310a6cdda0d57c9d9c04 (diff) |
Bugfix: error when saving files with VERY long names (thanx to 4mz)
Diffstat (limited to 'habraparse.py')
-rwxr-xr-x | habraparse.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/habraparse.py b/habraparse.py index 2261e5b..97efcf4 100755 --- a/habraparse.py +++ b/habraparse.py @@ -138,6 +138,8 @@ def save_all_favs_for_user(username, out_dir, save_in_html=True, with_comments=F # topic = HabraTopic(topic_id) if save_by_name: t_name = topic_name.replace('/', '_').replace('\\', '_').replace('!', '.') + if len(t_name) > 250: + t_name = t_name[:250] filename = '{dir}/{name}.{filetype}'.format(dir=out_dir, name=t_name, filetype=filetype) else: filename = '{dir}/{id}.{filetype}'.format(dir=out_dir, id=topic_id, filetype=filetype) |