add .md in journal_file_resolver

I'm confident enough that this is what I want to do for resolving
content, at least at the moment
This commit is contained in:
Brian S. Stephan 2020-03-07 09:45:00 -06:00
parent 1d446436ad
commit 2d3a5c10aa
2 changed files with 4 additions and 3 deletions

View File

@ -20,4 +20,5 @@ def journal_file_resolver(path):
"""
if path.endswith('/'):
path = f'{path}index'
path = f'{path}.md'
return path

View File

@ -3,12 +3,12 @@ from incorporealcms.journal import journal_file_resolver
def test_journal_file_resolver_dir_to_index():
assert journal_file_resolver('/foo/') == '/foo/index'
assert journal_file_resolver('/foo/') == '/foo/index.md'
def test_journal_file_resolver_subdir_to_index():
assert journal_file_resolver('/foo/bar/') == '/foo/bar/index'
assert journal_file_resolver('/foo/bar/') == '/foo/bar/index.md'
def test_journal_file_resolver_other_requests_fine():
assert journal_file_resolver('/foo/baz') == '/foo/baz'
assert journal_file_resolver('/foo/baz') == '/foo/baz.md'