Only allow directories for directorylisting
This commit is contained in:
parent
8a040fbb75
commit
5374315e76
|
@ -878,6 +878,10 @@ class ServeFile():
|
||||||
FilePutter.maxUploadSize = self.maxUploadSize
|
FilePutter.maxUploadSize = self.maxUploadSize
|
||||||
handler = FilePutter
|
handler = FilePutter
|
||||||
elif self.serveMode == self.MODE_LISTDIR:
|
elif self.serveMode == self.MODE_LISTDIR:
|
||||||
|
if not os.path.exists(self.target):
|
||||||
|
raise ServeFileException("Error: Could not open file or directory.")
|
||||||
|
if not os.path.isdir(self.target):
|
||||||
|
raise ServeFileException("Error: '%s' is not a directory." % (self.target,))
|
||||||
handler = DirListingHandler
|
handler = DirListingHandler
|
||||||
handler.targetDir = self.target
|
handler.targetDir = self.target
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue