diff --git a/server/executor.py b/server/executor.py index 4586c5c..41ee405 100644 --- a/server/executor.py +++ b/server/executor.py @@ -34,7 +34,7 @@ class Executor: def setCurrentDirectory(self, dirName: str) -> str: if dirName == "..": - if self.currentDirectory == self.baseDir: + if self.currentDirectory == "": return self.currentDirectory else: directories = self.currentDirectory.split(os.path.sep) @@ -42,13 +42,13 @@ class Executor: for dir in directories: strdirectory += dir + os.path.sep strdirectory = strdirectory[:-3] - if os.path.exists(strdirectory): + if os.path.exists(os.path.join(self.baseDir, self.currentDirectory)): self.currentDirectory = strdirectory return self.currentDirectory else: dirName = self.sanitizeDirectory(dirName) - joinedDir = os.path.join(self.baseDir, self.currentDirectory, dirName) - if os.path.exists(joinedDir): + joinedDir = os.path.join(self.currentDirectory, dirName) + if os.path.join(self.baseDir, joinedDir): self.currentDirectory = joinedDir return self.currentDirectory