It would appear that only filenames are sanitised and not the directory structure. I have applied the following quick fix in misc.py and have added sanitize_dirname immediately following sanitise_pathname. I have also highlighted in red the single change required in CreateAllDirs.
This is just a quick fix and I have not gone through the code in any great depth, as no doubt you will want to revise this and incorporate into a future release.
Regards,
Craig.
################################################################################
# sanitize_dirname #
################################################################################
def sanitize_dirname(name):
""" Return pathname with illegal chars converted to legal ones
"""
illegal = r'\/?*:;|"'
legal = r'++{}!@--#`'
repl = sabnzbd.REPLACE_ILLEGAL
lst = []
for ch in name.strip():
if ch in illegal:
if repl:
ch = legal[illegal.find(ch)]
lst.append(ch)
else:
lst.append(ch)
name = ''.join(lst)
if not name:
name = 'unknown'
return name
################################################################################
# DirPermissions #
################################################################################
def CreateAllDirs(path, umask=None):
""" Create all required path elements and set umask on all
Return True if last elelent could be made or exists """
result = True
if os.name == 'nt':
try:
os.makedirs(path)
except:
result = False
else:
list = []
list.extend(path.split('/'))
path = ''
for d in list:
if d:
path += '/' + sanitize_dirname(d)
if not os.path.exists(path):
try:
os.mkdir(path)
result = True
except:
result = False
try:
if umask: os.chmod(path, int(umask,

except:
pass
return result