mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 03:33:02 +00:00
parent
76c73715fb
commit
a7440261c5
2 changed files with 4 additions and 0 deletions
|
@ -85,8 +85,11 @@ def test_sanitize_filename(self):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
sanitize_filename('New World record at 0:12:34'),
|
sanitize_filename('New World record at 0:12:34'),
|
||||||
'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'), '_-gasdgf')
|
||||||
self.assertEqual(sanitize_filename('--gasdgf', is_id=True), '--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\\/'
|
forbidden = '"\0\\/'
|
||||||
for fc in forbidden:
|
for fc in forbidden:
|
||||||
|
|
|
@ -305,6 +305,7 @@ def replace_insane(char):
|
||||||
result = result[2:]
|
result = result[2:]
|
||||||
if result.startswith('-'):
|
if result.startswith('-'):
|
||||||
result = '_' + result[len('-'):]
|
result = '_' + result[len('-'):]
|
||||||
|
result = result.lstrip('.')
|
||||||
if not result:
|
if not result:
|
||||||
result = '_'
|
result = '_'
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in a new issue