diff options
author | Nitzo <nitzo2001@yahoo.com> | 2016-01-11 22:13:42 +0100 |
---|---|---|
committer | Nitzo <nitzo2001@yahoo.com> | 2016-01-11 22:13:42 +0100 |
commit | eb696b47b537f097e5094ef58086277e50b04dd6 (patch) | |
tree | ab395b2aa7e6922993c6bd976d5a7b1688a41d7f /module/plugins/internal/misc.py | |
parent | fix #2284 (thanks @youlJunior) (diff) | |
download | pyload-eb696b47b537f097e5094ef58086277e50b04dd6.tar.xz |
[Misc] Update
Diffstat (limited to 'module/plugins/internal/misc.py')
-rw-r--r-- | module/plugins/internal/misc.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/module/plugins/internal/misc.py b/module/plugins/internal/misc.py index 43ddf2752..b5046e962 100644 --- a/module/plugins/internal/misc.py +++ b/module/plugins/internal/misc.py @@ -38,7 +38,7 @@ except ImportError: class misc(object): __name__ = "misc" __type__ = "plugin" - __version__ = "0.22" + __version__ = "0.23" __status__ = "stable" __pattern__ = r'^unmatchable$' @@ -476,9 +476,13 @@ def safepath(value): """ Remove invalid characters and truncate the path if needed """ + if os.name == "nt": + unt, value = os.path.splitunc(value) + else: + unt = "" drive, filename = os.path.splitdrive(value) filename = os.path.join(os.sep if os.path.isabs(filename) else "", *map(safename, filename.split(os.sep))) - path = drive + filename + path = unt + drive + filename try: if os.name != "nt": @@ -490,12 +494,11 @@ def safepath(value): dirname, basename = os.path.split(filename) name, ext = os.path.splitext(basename) - path = drive + dirname + truncate(name, length) + ext + path = unt + drive + dirname + truncate(name, length) + ext finally: return path - def safejoin(*args): """ os.path.join + safepath |