mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Server: limit logging when resolving get request
This commit is contained in:
parent
940d4534a1
commit
dc05d0ea5e
1 changed files with 6 additions and 4 deletions
|
|
@ -42,8 +42,6 @@ def parse_arguments():
|
|||
|
||||
|
||||
class ComplexHTTPRequestHandler(srvmod.SimpleHTTPRequestHandler):
|
||||
SUFFIXES = ['.html', '/index.html', '/', '']
|
||||
|
||||
def translate_path(self, path):
|
||||
# abandon query parameters
|
||||
path = path.split('?', 1)[0]
|
||||
|
|
@ -82,11 +80,15 @@ class ComplexHTTPRequestHandler(srvmod.SimpleHTTPRequestHandler):
|
|||
# Try to strip trailing slash
|
||||
original_path = original_path.rstrip('/')
|
||||
# Try to detect file by applying various suffixes
|
||||
for suffix in self.SUFFIXES:
|
||||
if os.path.isdir(original_path):
|
||||
suffixes = ['.html', '/index.html', '/']
|
||||
else:
|
||||
suffixes = ['', '.html']
|
||||
for suffix in suffixes:
|
||||
path = original_path + suffix
|
||||
if os.path.exists(self.translate_path(path)):
|
||||
return path
|
||||
logging.info("Tried to find `%s`, but it doesn't exist.", path)
|
||||
logging.debug("Tried to find `%s`, but it doesn't exist.", path)
|
||||
return None
|
||||
|
||||
def guess_type(self, path):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue