aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/compat.py
diff options
context:
space:
mode:
Diffstat (limited to 'youtube_dl/compat.py')
-rw-r--r--youtube_dl/compat.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/youtube_dl/compat.py b/youtube_dl/compat.py
index 9d33a8ec5..549206534 100644
--- a/youtube_dl/compat.py
+++ b/youtube_dl/compat.py
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
import getpass
import optparse
import os
+import re
import subprocess
import sys
@@ -174,7 +175,10 @@ try:
from shlex import quote as shlex_quote
except ImportError: # Python < 3.3
def shlex_quote(s):
- return "'" + s.replace("'", "'\"'\"'") + "'"
+ if re.match(r'^[-_\w./]+$', s):
+ return s
+ else:
+ return "'" + s.replace("'", "'\"'\"'") + "'"
def compat_ord(c):