Allow empty foldernames
Empty foldernames (as they could be created through nametrans) were failing as the uidvalidity and status files names as determined by folder/Base.py:getfolderbasename() lead to invalid file names ''. Fix this by handling empty file names and translating them to '.' which leads to the special file name 'dot'. (this special value existed before and was not invented by this patch) Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:

committed by
Nicolas Sebrecht

parent
4f1cd05fdc
commit
373e7cdbc1
@ -50,10 +50,17 @@ class LocalStatusRepository(BaseRepository):
|
||||
return '.'
|
||||
|
||||
def getfolderfilename(self, foldername):
|
||||
"""Return the full path of the status file"""
|
||||
# replace with 'dot' if final path name is '.'
|
||||
foldername = re.sub('(^|\/)\.$','\\1dot', foldername)
|
||||
return os.path.join(self.directory, foldername)
|
||||
"""Return the full path of the status file
|
||||
|
||||
This mimics the path that Folder().getfolderbasename() would return"""
|
||||
if not foldername:
|
||||
basename = '.'
|
||||
else: #avoid directory hierarchies and file names such as '/'
|
||||
basename = foldername.replace('/', '.')
|
||||
# replace with literal 'dot' if final path name is '.' as '.' is
|
||||
# an invalid file name.
|
||||
basename = re.sub('(^|\/)\.$','\\1dot', basename)
|
||||
return os.path.join(self.directory, basename)
|
||||
|
||||
def makefolder(self, foldername):
|
||||
"""Create a LocalStatus Folder
|
||||
|
Reference in New Issue
Block a user