Limit debug filename to a sane number of characters

This commit is contained in:
Laurent Bachelier 2014-03-27 23:41:31 +01:00
commit c4b40e85e9

View file

@ -155,7 +155,7 @@ class BaseBrowser(object):
# try to get an extension (and avoid adding 'None')
ext = mimetypes.guess_extension(mimetype, False) or ''
path = re.sub('[^A-z0-9\.-_]+', '_', urlparse(response.url).path.rpartition('/')[2])
path = re.sub('[^A-z0-9\.-_]+', '_', urlparse(response.url).path.rpartition('/')[2])[-10:]
if path.endswith(ext):
ext = ''
filename = '%02d-%d%s%s%s' % \