mirror of https://github.com/docker/docker-py.git
Leading slash in .dockerignore should be ignored
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
5e4a69bbda
commit
92a2e48e17
|
@ -26,6 +26,7 @@ def exclude_paths(root, patterns, dockerfile=None):
|
|||
if dockerfile is None:
|
||||
dockerfile = 'Dockerfile'
|
||||
|
||||
patterns = [p.lstrip('/') for p in patterns]
|
||||
exceptions = [p for p in patterns if p.startswith('!')]
|
||||
|
||||
include_patterns = [p[1:] for p in exceptions]
|
||||
|
|
|
@ -768,6 +768,11 @@ class ExcludePathsTest(unittest.TestCase):
|
|||
self.all_paths - set(['foo/a.py'])
|
||||
)
|
||||
|
||||
def test_single_subdir_single_filename_leading_slash(self):
|
||||
assert self.exclude(['/foo/a.py']) == convert_paths(
|
||||
self.all_paths - set(['foo/a.py'])
|
||||
)
|
||||
|
||||
def test_single_subdir_with_path_traversal(self):
|
||||
assert self.exclude(['foo/whoops/../a.py']) == convert_paths(
|
||||
self.all_paths - set(['foo/a.py'])
|
||||
|
|
Loading…
Reference in New Issue