diff --git a/src/irclog2html/irclogserver.py b/src/irclog2html/irclogserver.py index 0843498..7524591 100755 --- a/src/irclog2html/irclogserver.py +++ b/src/irclog2html/irclogserver.py @@ -62,7 +62,7 @@ def parse_path(environ): path = environ.get('PATH_INFO', '/') path = path[1:] # Remove the leading slash channel = None - if environ.get('IRCLOG_CHAN_DIR'): + if environ.get('IRCLOG_CHAN_DIR', os.environ.get('IRCLOG_CHAN_DIR')): if '/' in path: channel, path = path.split('/', 1) if channel == '..': diff --git a/src/irclog2html/tests/test_irclogserver.py b/src/irclog2html/tests/test_irclogserver.py index 4a77848..e5848a8 100644 --- a/src/irclog2html/tests/test_irclogserver.py +++ b/src/irclog2html/tests/test_irclogserver.py @@ -235,6 +235,14 @@ def test_chan_os_environ(self, environ): self.assertIn(b'IRC logs', response.body) self.assertIn(b'#chan', response.body) + @mock.patch("os.environ") + def test_chan_search_page(self, environ): + os.environ.get = {"IRCLOG_CHAN_DIR": self.tmpdir}.get + response = self.request( + '/#chan/search') + self.assertEqual(response.content_type, 'text/html; charset=UTF-8') + self.assertIn(b'Search IRC logs', response.body) + def test_suite(): return unittest.TestSuite([