fixed serious issue with adding file paths into kb.absFilePaths (dirname was wrongly added, and afterwards getDirs used dirname of dirname)

also, fixed some issues with Windows paths
This commit is contained in:
Miroslav Stampar 2010-02-03 16:40:12 +00:00
parent 7c88e32f9d
commit ea045eaa2f
3 changed files with 4 additions and 4 deletions

View File

@ -246,7 +246,7 @@ def getDocRoot():
if absFilePathWin: if absFilePathWin:
docRoot = "C:/%s" % docRoot.replace("\\", "/") docRoot = "C:/%s" % docRoot.replace("\\", "/")
docRoot = docRoot.replace("//", "/") docRoot = normalizePath(docRoot)
break break
if docRoot: if docRoot:

View File

@ -84,8 +84,7 @@ def parseResponse(page, headers):
if re.search("\A[A-Za-z]:", absFilePath): if re.search("\A[A-Za-z]:", absFilePath):
absFilePath = absFilePath.replace("/", "\\") absFilePath = absFilePath.replace("/", "\\")
if absFilePath not in kb.absFilePaths: if absFilePath not in kb.absFilePaths:
dirname = directoryPath(absFilePath) kb.absFilePaths.add(absFilePath)
kb.absFilePaths.add(dirname)
def decodePage(page, encoding): def decodePage(page, encoding):

View File

@ -175,9 +175,10 @@ class Web:
payload = agent.payload(newValue=query) payload = agent.payload(newValue=query)
page = Request.queryPage(payload) page = Request.queryPage(payload)
requestDir = normalizePath(directory.replace(kb.docRoot, "/").replace("\\", "/")) requestDir = directory.replace('\\', '/').replace(kb.docRoot.replace('\\', '/'), "/").replace("//", "/")
if re.search("\A[A-Za-z]:", requestDir): if re.search("\A[A-Za-z]:", requestDir):
requestDir = requestDir[2:] requestDir = requestDir[2:]
requestDir = normalizePath(requestDir)
self.webBaseUrl = "%s://%s:%d%s" % (conf.scheme, conf.hostname, conf.port, requestDir) self.webBaseUrl = "%s://%s:%d%s" % (conf.scheme, conf.hostname, conf.port, requestDir)
self.webUploaderUrl = "%s/%s" % (self.webBaseUrl, uploaderName) self.webUploaderUrl = "%s/%s" % (self.webBaseUrl, uploaderName)
self.webUploaderUrl = self.webUploaderUrl.replace("./", "/").replace("\\", "/") self.webUploaderUrl = self.webUploaderUrl.replace("./", "/").replace("\\", "/")