From ea045eaa2fb62b505856fa6fc9b383740b4ad233 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 3 Feb 2010 16:40:12 +0000 Subject: [PATCH] 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 --- lib/core/common.py | 2 +- lib/request/basic.py | 3 +-- lib/takeover/web.py | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index 480ee9d8e..af455adc8 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -246,7 +246,7 @@ def getDocRoot(): if absFilePathWin: docRoot = "C:/%s" % docRoot.replace("\\", "/") - docRoot = docRoot.replace("//", "/") + docRoot = normalizePath(docRoot) break if docRoot: diff --git a/lib/request/basic.py b/lib/request/basic.py index 2bb923aae..be27c31f9 100644 --- a/lib/request/basic.py +++ b/lib/request/basic.py @@ -84,8 +84,7 @@ def parseResponse(page, headers): if re.search("\A[A-Za-z]:", absFilePath): absFilePath = absFilePath.replace("/", "\\") if absFilePath not in kb.absFilePaths: - dirname = directoryPath(absFilePath) - kb.absFilePaths.add(dirname) + kb.absFilePaths.add(absFilePath) def decodePage(page, encoding): diff --git a/lib/takeover/web.py b/lib/takeover/web.py index 75baf0c25..6dba2078f 100644 --- a/lib/takeover/web.py +++ b/lib/takeover/web.py @@ -175,9 +175,10 @@ class Web: payload = agent.payload(newValue=query) 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): requestDir = requestDir[2:] + requestDir = normalizePath(requestDir) self.webBaseUrl = "%s://%s:%d%s" % (conf.scheme, conf.hostname, conf.port, requestDir) self.webUploaderUrl = "%s/%s" % (self.webBaseUrl, uploaderName) self.webUploaderUrl = self.webUploaderUrl.replace("./", "/").replace("\\", "/")