1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-22 16:44:32 +01:00

Adjust max filename length to fit Docker limits (#1)

Docker / AUFS has a NAME_MAX of 242.
This commit is contained in:
handeln 2017-11-24 15:46:45 -05:00 committed by GitHub
parent cd9ff4ec5b
commit 43f0a3abc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -597,9 +597,9 @@ class InfoExtractor(object):
self._downloader.to_screen(dump)
if self._downloader.params.get('write_pages', False):
basen = '%s_%s' % (video_id, urlh.geturl())
if len(basen) > 240:
if len(basen) > 237:
h = '___' + hashlib.md5(basen.encode('utf-8')).hexdigest()
basen = basen[:240 - len(h)] + h
basen = basen[:237 - len(h)] + h
raw_filename = basen + '.dump'
filename = sanitize_filename(raw_filename, restricted=True)
self.to_screen('Saving request to ' + filename)