Fix handling of / as path
This commit is contained in:
parent
16b3b7a262
commit
cbf1a44b75
@ -556,7 +556,10 @@ class FilenamePrompt(_BasePrompt):
|
||||
dirname = os.path.dirname(path)
|
||||
|
||||
try:
|
||||
if path[-1] in separators and os.path.isdir(path):
|
||||
if path in separators and os.path.isdir(path):
|
||||
# Input "/" -> don't strip anything
|
||||
pass
|
||||
elif path[-1] in separators and os.path.isdir(path):
|
||||
# Input like /foo/bar/ -> show /foo/bar/ contents
|
||||
path = path.rstrip(separators)
|
||||
elif os.path.isdir(dirname) and not tabbed:
|
||||
|
@ -85,3 +85,9 @@ class TestFileCompletion:
|
||||
prompt.item_focus('next')
|
||||
prompt.item_focus('next')
|
||||
assert prompt._lineedit.text() == str(tmpdir / 'bar')
|
||||
|
||||
@pytest.mark.linux
|
||||
def test_root_path(self, get_prompt):
|
||||
"""With / as path, show root contents."""
|
||||
prompt = get_prompt('/')
|
||||
assert prompt._file_model.rootPath() == '/'
|
||||
|
Loading…
Reference in New Issue
Block a user