summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/plugins/internal/misc.py11
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