summaryrefslogtreecommitdiffstats
path: root/pyload/utils
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-11 17:09:47 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-11 17:09:47 +0100
commitda6ab98c8918bd2e5110818206b24cfccc6647ea (patch)
treeb49e67dcc4c34a9c181dc61b988a162b9ba13638 /pyload/utils
parentSpare code cosmetics (diff)
downloadpyload-da6ab98c8918bd2e5110818206b24cfccc6647ea.tar.xz
Str unquote stuff
Diffstat (limited to 'pyload/utils')
-rw-r--r--pyload/utils/__init__.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pyload/utils/__init__.py b/pyload/utils/__init__.py
index 004274c3e..39a3ae751 100644
--- a/pyload/utils/__init__.py
+++ b/pyload/utils/__init__.py
@@ -8,6 +8,7 @@ import time
import re
from os.path import join
from string import maketrans
+from urllib import unquote
from htmlentitydefs import name2codepoint
# abstraction layer for json operations
@@ -58,7 +59,7 @@ def remove_chars(string, repl):
def safe_filename(name):
""" remove bad chars """
- name = name.encode('ascii', 'replace') # Non-ASCII chars usually breaks file saving. Replacing.
+ name = unquote(name).encode('ascii', 'replace') # Non-ASCII chars usually breaks file saving. Replacing.
if os.name == 'nt':
return remove_chars(name, u'\00\01\02\03\04\05\06\07\10\11\12\13\14\15\16\17\20\21\22\23\24\25\26\27\30\31\32'
u'\33\34\35\36\37/?%*|"<>')
@@ -84,7 +85,7 @@ def save_join(*args):
if sys.getfilesystemencoding().startswith('ANSI'):
def fs_encode(string):
- return save_path(encode(string))
+ return safe_filename(encode(string))
fs_decode = decode #decode utf8