code: def modify_request(self, request):
          
          filename = URL.build(path=request.match_info['filename'], encoded=True).path
          raw_path = self._directory.joinpath(filename)
          try:
              filepath = raw_path.resolve()
              if not filepath.exists():
                  # simulate strict=True for python 3.6 which is not permitted with 3.5
                  raise FileNotFoundError()
          except FileNotFoundError:
              try:
                  html_file = raw_path.with_name(raw_path.name + '.html').resolve().relative_to(self._directory)
              except (FileNotFoundError, ValueError):
                  pass
              else:
                  request.match_info['filename'] = str(html_file)
          else:
              if filepath.is_dir():
                  index_file = filepath / 'index.html'
                  if index_file.exists():
                      try:
                          request.match_info['filename'] = str(index_file.relative_to(self._directory))
                      except ValueError:
                          # path is not not relative to self._directory
                          pass
docs: Apply common path conventions eg. / > /index.html, /foobar > /foobar.html