diff --git a/MicroWebSrv2/__init__.py b/MicroWebSrv2/__init__.py index 21f7e65..1829e87 100644 --- a/MicroWebSrv2/__init__.py +++ b/MicroWebSrv2/__init__.py @@ -7,7 +7,7 @@ print() print(' ---------------------------') print(' - Python pkg MicroWebSrv2 -') -print(' - version 2.0.3 -') +print(' - version 2.0.4 -') print(' - by JC`zic & HC2 -') print(' ---------------------------') print() diff --git a/MicroWebSrv2/microWebSrv2.py b/MicroWebSrv2/microWebSrv2.py index b74d4aa..6aca431 100644 --- a/MicroWebSrv2/microWebSrv2.py +++ b/MicroWebSrv2/microWebSrv2.py @@ -257,19 +257,16 @@ def ResolvePhysicalPath(self, urlPath) : raise ValueError('"urlPath" must be a not empty string.') try : physPath = self._rootPath + urlPath.replace('..', '/') + if physPath.endswith('/') : + physPath = physPath[:-1] if MicroWebSrv2._physPathIsDir(physPath) : - if not physPath.endswith('/') : - physPath += '/' for filename in MicroWebSrv2._DEFAULT_PAGES : - p = physPath + filename + p = physPath + '/' + filename if MicroWebSrv2._physPathExists(p) : return p - return physPath - elif not physPath.endswith('/') : - return physPath + return physPath except : - pass - return None + return None # ------------------------------------------------------------------------ @@ -477,7 +474,7 @@ def RootPath(self, value) : if not isinstance(value, str) or len(value) == 0 : raise ValueError('"RootPath" must be a not empty string.') self._validateChangeConf('"RootPath"') - self._rootPath = value + self._rootPath = (value[:-1] if value.endswith('/') else value) # ------------------------------------------------------------------------