From da6ab98c8918bd2e5110818206b24cfccc6647ea Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 11 Dec 2014 17:09:47 +0100 Subject: Str unquote stuff --- pyload/utils/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pyload/utils/__init__.py') 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 -- cgit v1.2.3