From e9499a857f46f4d70624deaa280eccc355ad4ba4 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 24 Aug 2023 22:58:38 -0400 Subject: [PATCH] bugfix --- ahserver/baseProcessor.py | 1 + ahserver/processorResource.py | 1 + ahserver/url2file.py | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/ahserver/baseProcessor.py b/ahserver/baseProcessor.py index 5ef135b..4e778fe 100755 --- a/ahserver/baseProcessor.py +++ b/ahserver/baseProcessor.py @@ -183,6 +183,7 @@ class PythonScriptProcessor(BaseProcessor): lenv = self.run_ns del lenv['request'] txt = self.loadScript(self.real_path) + # print(self.real_path, "#########", txt) exec(txt,lenv,lenv) func = lenv['myfunc'] return await func(request,**lenv) diff --git a/ahserver/processorResource.py b/ahserver/processorResource.py index eb5e864..4ca22c6 100755 --- a/ahserver/processorResource.py +++ b/ahserver/processorResource.py @@ -308,6 +308,7 @@ class ProcessorResource(AppLogger, StaticResource,Url2File): if not config.website.allowListFolder: self.error('%s:not found' % str(request.url)) raise HTTPNotFound + # print(f'{self.request_filename=}, {str(request.url)=}') return await super()._handle(request) def gethost(self, request): diff --git a/ahserver/url2file.py b/ahserver/url2file.py index c139cc6..64dbe17 100755 --- a/ahserver/url2file.py +++ b/ahserver/url2file.py @@ -30,6 +30,7 @@ class Url2File: paths = paths[3:] f = os.path.join(self.path,*paths) real_path = os.path.abspath(f) + # print(f'{real_path=}, {url=}, {f=}') return real_path def url2file(self, url: str) -> str: @@ -40,6 +41,7 @@ class Url2File: for idx in self.indexes: p = os.path.join(real_path,idx) if os.path.isfile(p): + # print(f'{url=}, {real_path=}, {idx=}, {p=}') return p if os.path.isfile(real_path): @@ -56,7 +58,9 @@ class Url2File: items = url.split('/') if len(items) > 2: del items[-2] + oldurl = url url = '/'.join(items) + # print(f'{oldurl=}, {url=}') return self.url2file(url) print(f'url2file() return None finally, {items:}, {url=}, {ourl=}, {self.path=}') return None