diff --git a/app/__init__.py b/app/__init__.py index aecd424..f3f8acb 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -29,7 +29,8 @@ def render_page(page): path = f'{PANDOC_PATH}/{page}' whitelist = WHITELIST_PATH with open(whitelist, 'r') as f: - if page not in f.readlines(): + lines = f.read().splitlines() + if page not in lines: raise Exception("Page doesn't exist!") if not os.path.exists(f'{path}'): raise Exception("Page doesn't exist!") @@ -45,7 +46,9 @@ def get_pandoc_page(page): path = f'{PANDOC_PATH}/{page}' whitelist = WHITELIST_PATH with open(whitelist, 'r') as f: - if page not in f.readlines(): + lines = f.read().splitlines() + if page not in lines: + print('Access to page not in list {page}') return 'This page does not exist' if not os.path.exists(f'{path}'): # TODO: Add 404 handler