From a3047008ddee7b83a8cb8914686651928f16423e Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 2 Aug 2016 16:12:09 +0200 Subject: [PATCH] Bump up filename length limit to 50 The usual limit seems to be 255 bytes, so even when assuming 5-byte UTF-8 chars for every letter, 50 should be fine. http://serverfault.com/questions/9546/filename-length-limits-on-linux/9548#9548 --- qutebrowser/browser/webkit/downloads.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/webkit/downloads.py b/qutebrowser/browser/webkit/downloads.py index 723edebb8..e5f9e8709 100644 --- a/qutebrowser/browser/webkit/downloads.py +++ b/qutebrowser/browser/webkit/downloads.py @@ -1334,8 +1334,8 @@ class TempDownloadManager(QObject): encoding = sys.getfilesystemencoding() suggested_name = utils.force_encoding(suggested_name, encoding) # Make sure that the filename is not too long - if len(suggested_name) > 20: - suggested_name = suggested_name[:10] + '...' + suggested_name[-10:] + if len(suggested_name) > 50: + suggested_name = suggested_name[:25] + '...' + suggested_name[-25:] fobj = tempfile.NamedTemporaryFile(dir=tmpdir.name, delete=False, suffix=suggested_name) self.files.append(fobj)