|
|
@ -312,7 +312,7 @@ class DirListingHandler(FileBaseHandler):
|
|
|
|
path = self.getCleanPath()
|
|
|
|
path = self.getCleanPath()
|
|
|
|
|
|
|
|
|
|
|
|
# check if path is in current serving directory
|
|
|
|
# check if path is in current serving directory
|
|
|
|
currBaseDir = os.path.abspath(self.targetDir) + os.path.sep
|
|
|
|
currBaseDir = self.targetDir + os.path.sep
|
|
|
|
requestPath = os.path.normpath(os.path.join(currBaseDir, path)) + os.path.sep
|
|
|
|
requestPath = os.path.normpath(os.path.join(currBaseDir, path)) + os.path.sep
|
|
|
|
if not requestPath.startswith(currBaseDir):
|
|
|
|
if not requestPath.startswith(currBaseDir):
|
|
|
|
self.send_response(301)
|
|
|
|
self.send_response(301)
|
|
|
@ -1041,7 +1041,7 @@ class ServeFile():
|
|
|
|
raise ServeFileException("Error: Could not create directory '%s' for uploads, %r" % (self.target, str(e)))
|
|
|
|
raise ServeFileException("Error: Could not create directory '%s' for uploads, %r" % (self.target, str(e)))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
raise ServeFileException("Error: Upload directory already exists and is a file.")
|
|
|
|
raise ServeFileException("Error: Upload directory already exists and is a file.")
|
|
|
|
FilePutter.targetDir = self.target
|
|
|
|
FilePutter.targetDir = os.path.abspath(self.target)
|
|
|
|
FilePutter.maxUploadSize = self.maxUploadSize
|
|
|
|
FilePutter.maxUploadSize = self.maxUploadSize
|
|
|
|
handler = FilePutter
|
|
|
|
handler = FilePutter
|
|
|
|
elif self.serveMode == self.MODE_LISTDIR:
|
|
|
|
elif self.serveMode == self.MODE_LISTDIR:
|
|
|
@ -1050,7 +1050,7 @@ class ServeFile():
|
|
|
|
if not os.path.isdir(self.target):
|
|
|
|
if not os.path.isdir(self.target):
|
|
|
|
raise ServeFileException("Error: '%s' is not a directory." % (self.target,))
|
|
|
|
raise ServeFileException("Error: '%s' is not a directory." % (self.target,))
|
|
|
|
handler = DirListingHandler
|
|
|
|
handler = DirListingHandler
|
|
|
|
handler.targetDir = self.target
|
|
|
|
handler.targetDir = os.path.abspath(self.target)
|
|
|
|
|
|
|
|
|
|
|
|
if self.auth:
|
|
|
|
if self.auth:
|
|
|
|
# do authentication
|
|
|
|
# do authentication
|
|
|
|