mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-11-27 04:26:50 +01:00
parent
76c73715fb
commit
a7440261c5
@ -85,8 +85,11 @@ class TestUtil(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
sanitize_filename('New World record at 0:12:34'),
|
||||
'New World record at 0_12_34')
|
||||
|
||||
self.assertEqual(sanitize_filename('--gasdgf'), '_-gasdgf')
|
||||
self.assertEqual(sanitize_filename('--gasdgf', is_id=True), '--gasdgf')
|
||||
self.assertEqual(sanitize_filename('.gasdgf'), 'gasdgf')
|
||||
self.assertEqual(sanitize_filename('.gasdgf', is_id=True), '.gasdgf')
|
||||
|
||||
forbidden = '"\0\\/'
|
||||
for fc in forbidden:
|
||||
|
@ -305,6 +305,7 @@ def sanitize_filename(s, restricted=False, is_id=False):
|
||||
result = result[2:]
|
||||
if result.startswith('-'):
|
||||
result = '_' + result[len('-'):]
|
||||
result = result.lstrip('.')
|
||||
if not result:
|
||||
result = '_'
|
||||
return result
|
||||
|
Loading…
Reference in New Issue
Block a user