bugfix
This commit is contained in:
parent
4f42ba0227
commit
1834fde7d5
@ -230,7 +230,7 @@ class ProcessorResource(StaticResource,Url2File):
|
|||||||
if filepath and self.isHtml(filepath):
|
if filepath and self.isHtml(filepath):
|
||||||
return await self.html_handle(request, filepath)
|
return await self.html_handle(request, filepath)
|
||||||
|
|
||||||
if os.path.isdir(filepath):
|
if filepath and os.path.isdir(filepath):
|
||||||
config = getConfig()
|
config = getConfig()
|
||||||
if not config.website.allowListFolder:
|
if not config.website.allowListFolder:
|
||||||
raise HTTPNotFound
|
raise HTTPNotFound
|
||||||
@ -252,9 +252,11 @@ class ProcessorResource(StaticResource,Url2File):
|
|||||||
try:
|
try:
|
||||||
with codecs.open(fn,'r','utf-8') as f:
|
with codecs.open(fn,'r','utf-8') as f:
|
||||||
b = f.read()
|
b = f.read()
|
||||||
if b.startswith('<html>'):
|
while b[0] in ['\n',' ','\t']:
|
||||||
|
b = b[1:]
|
||||||
|
if b.lower().startswith('<html>'):
|
||||||
return True
|
return True
|
||||||
if b.startswith('<!doctype html>'):
|
if b.lower().startswith('<!doctype html>'):
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return False
|
return False
|
||||||
@ -285,6 +287,9 @@ class ProcessorResource(StaticResource,Url2File):
|
|||||||
if url.startswith('/'):
|
if url.startswith('/'):
|
||||||
return '%s%s' % (h,url)
|
return '%s%s' % (h,url)
|
||||||
path = request.path
|
path = request.path
|
||||||
|
fn = self.url2file(str(request.url))
|
||||||
|
if fn and os.path.isdir(fn):
|
||||||
|
path = '%s/oops' % path
|
||||||
p = self.relatedurl(path,url)
|
p = self.relatedurl(path,url)
|
||||||
return '%s%s' % (h, p)
|
return '%s%s' % (h, p)
|
||||||
|
|
||||||
|
2
setup.py
2
setup.py
@ -8,7 +8,7 @@ from setuptools import setup, find_packages
|
|||||||
# python setup.py bdist_egg generate a egg file
|
# python setup.py bdist_egg generate a egg file
|
||||||
# Release information about eway
|
# Release information about eway
|
||||||
|
|
||||||
version = "0.0.1"
|
version = "0.0.2"
|
||||||
name = "ahserver"
|
name = "ahserver"
|
||||||
description = "ahserver"
|
description = "ahserver"
|
||||||
author = "yumoqing"
|
author = "yumoqing"
|
||||||
|
Loading…
Reference in New Issue
Block a user