mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Adjust suffix in server to allow redirection when needed
Folders without index.html has to be redirected (/foo -> /foo/) for directory listing to work properly. Skip '/' suffix if original path does not have it so that base class can return a redirect.
This commit is contained in:
parent
f862d64b7a
commit
2d97a45902
2 changed files with 10 additions and 1 deletions
|
|
@ -43,14 +43,18 @@ class TestServer(unittest.TestCase):
|
|||
os.mkdir(os.path.join(self.temp_output, 'baz'))
|
||||
|
||||
for suffix in ['', '/']:
|
||||
# foo.html has precedence over foo/index.html
|
||||
path = handler.get_path_that_exists('foo' + suffix)
|
||||
self.assertEqual(path, 'foo.html')
|
||||
|
||||
# folder with index.html should return folder/index.html
|
||||
path = handler.get_path_that_exists('bar' + suffix)
|
||||
self.assertEqual(path, 'bar/index.html')
|
||||
|
||||
# folder without index.html should return same as input
|
||||
path = handler.get_path_that_exists('baz' + suffix)
|
||||
self.assertEqual(path, 'baz/')
|
||||
self.assertEqual(path, 'baz' + suffix)
|
||||
|
||||
# not existing path should return None
|
||||
path = handler.get_path_that_exists('quux' + suffix)
|
||||
self.assertIsNone(path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue