Rev4471, Allow files start with dot

This commit is contained in:
shortcutme 2020-03-21 19:51:44 +01:00
parent 1eec388252
commit 31d4304915
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
3 changed files with 4 additions and 2 deletions

View File

@ -13,7 +13,7 @@ class Config(object):
def __init__(self, argv):
self.version = "0.7.1"
self.rev = 4469
self.rev = 4471
self.argv = argv
self.action = None
self.test_parser = None

View File

@ -599,7 +599,7 @@ class ContentManager(object):
return False
elif len(relative_path) > 255:
return False
elif relative_path[0] in (".", "/"): # Starts with
elif relative_path[0] in ("/", "\\"): # Starts with
return False
elif relative_path[-1] in (".", " "): # Ends with
return False

View File

@ -258,11 +258,13 @@ class TestContent:
assert not site.content_manager.isValidRelativePath("any\\hello.txt") # \ not allowed
assert not site.content_manager.isValidRelativePath("/hello.txt") # Cannot start with /
assert not site.content_manager.isValidRelativePath("\\hello.txt") # Cannot start with \
assert not site.content_manager.isValidRelativePath("../hello.txt") # Not allowed .. in path
assert not site.content_manager.isValidRelativePath("\0hello.txt") # NULL character
assert not site.content_manager.isValidRelativePath("\31hello.txt") # 0-31 (ASCII control characters)
assert not site.content_manager.isValidRelativePath("any/hello.txt ") # Cannot end with space
assert not site.content_manager.isValidRelativePath("any/hello.txt.") # Cannot end with dot
assert site.content_manager.isValidRelativePath(".hello.txt") # Allow start with dot
assert not site.content_manager.isValidRelativePath("any/CON") # Protected names on Windows
assert not site.content_manager.isValidRelativePath("CON/any.txt")
assert not site.content_manager.isValidRelativePath("any/lpt1.txt")