Browse Source

Don't trim file names when renaming them (so revert to old behavior).

pull/148/head
shypike 11 years ago
parent
commit
6faeb578a7
  1. 8
      sabnzbd/misc.py

8
sabnzbd/misc.py

@ -226,7 +226,7 @@ FL_LEGAL = CH_LEGAL + "-''"
uFL_ILLEGAL = FL_ILLEGAL.decode('latin-1') uFL_ILLEGAL = FL_ILLEGAL.decode('latin-1')
uFL_LEGAL = FL_LEGAL.decode('latin-1') uFL_LEGAL = FL_LEGAL.decode('latin-1')
def sanitize_foldername(name): def sanitize_foldername(name, limit=True):
""" Return foldername with dodgy chars converted to safe ones """ Return foldername with dodgy chars converted to safe ones
Remove any leading and trailing dot and space characters Remove any leading and trailing dot and space characters
""" """
@ -260,7 +260,7 @@ def sanitize_foldername(name):
name = 'unknown' name = 'unknown'
maxlen = cfg.folder_max_length() maxlen = cfg.folder_max_length()
if len(name) > maxlen: if limit and len(name) > maxlen:
name = name[:maxlen] name = name[:maxlen]
return name return name
@ -1237,7 +1237,9 @@ def renamer(old, new):
""" Rename file/folder with retries for Win32 """ """ Rename file/folder with retries for Win32 """
# Sanitize last part of new name # Sanitize last part of new name
path, name = os.path.split(new) path, name = os.path.split(new)
new = os.path.join(path, sanitize_foldername(name)) # Use the more stringent folder rename to end up with a nicer name,
# but do not trim size
new = os.path.join(path, sanitize_foldername(name, False))
if sabnzbd.WIN32: if sabnzbd.WIN32:
retries = 15 retries = 15

Loading…
Cancel
Save