This commit is contained in:
parent
c4333ed827
commit
034f1e3403
@ -51,7 +51,7 @@ class Server:
|
|||||||
if self.executor.baseDir == "":
|
if self.executor.baseDir == "":
|
||||||
raise Exception("Home directory must not be empty string. Did the user log in?")
|
raise Exception("Home directory must not be empty string. Did the user log in?")
|
||||||
if command == "LOUT":
|
if command == "LOUT":
|
||||||
if secondParam != "" or firstParam != "":
|
if not (secondParam == "" and firstParam == ""):
|
||||||
self.networkInstance.sendMessage("ERROR".encode('UTF-8'))
|
self.networkInstance.sendMessage("ERROR".encode('UTF-8'))
|
||||||
else:
|
else:
|
||||||
self.networkInstance.sendMessage("OK".encode('UTF-8'))
|
self.networkInstance.sendMessage("OK".encode('UTF-8'))
|
||||||
@ -69,7 +69,7 @@ class Server:
|
|||||||
self.executor.removeDirectory(firstParam)
|
self.executor.removeDirectory(firstParam)
|
||||||
self.networkInstance.sendMessage("OK".encode('UTF-8'))
|
self.networkInstance.sendMessage("OK".encode('UTF-8'))
|
||||||
elif command == "GWD":
|
elif command == "GWD":
|
||||||
if secondParam != "" or firstParam != "":
|
if not (secondParam == "" and firstParam == ""):
|
||||||
self.networkInstance.sendMessage("ERROR".encode('UTF-8'))
|
self.networkInstance.sendMessage("ERROR".encode('UTF-8'))
|
||||||
else:
|
else:
|
||||||
self.networkInstance.sendMessage(self.executor.getCurrentDirectory().encode('UTF-8'))
|
self.networkInstance.sendMessage(self.executor.getCurrentDirectory().encode('UTF-8'))
|
||||||
@ -80,7 +80,7 @@ class Server:
|
|||||||
self.executor.setCurrentDirectory(firstParam)
|
self.executor.setCurrentDirectory(firstParam)
|
||||||
self.networkInstance.sendMessage("OK".encode('UTF-8'))
|
self.networkInstance.sendMessage("OK".encode('UTF-8'))
|
||||||
elif command == "LST":
|
elif command == "LST":
|
||||||
if secondParam != "" or firstParam != "":
|
if not (secondParam == "" and firstParam == ""):
|
||||||
self.networkInstance.sendMessage("ERROR".encode('UTF-8'))
|
self.networkInstance.sendMessage("ERROR".encode('UTF-8'))
|
||||||
else:
|
else:
|
||||||
self.networkInstance.sendMessage(self.executor.listCurrentDirectoryContent().encode('UTF-8'))
|
self.networkInstance.sendMessage(self.executor.listCurrentDirectoryContent().encode('UTF-8'))
|
||||||
@ -109,7 +109,7 @@ class Server:
|
|||||||
file = self.executor.getFileInCurrentDirectory(firstParam)
|
file = self.executor.getFileInCurrentDirectory(firstParam)
|
||||||
self.networkInstance.sendMessage(file)
|
self.networkInstance.sendMessage(file)
|
||||||
self.networkInstance.sendMessage("EOF".encode('UTF-8'))
|
self.networkInstance.sendMessage("EOF".encode('UTF-8'))
|
||||||
except:
|
except Exception:
|
||||||
self.networkInstance.sendMessage("ERROR".encode('UTF-8'))
|
self.networkInstance.sendMessage("ERROR".encode('UTF-8'))
|
||||||
else:
|
else:
|
||||||
self.networkInstance.sendMessage("ERROR".encode('UTF-8'))
|
self.networkInstance.sendMessage("ERROR".encode('UTF-8'))
|
||||||
|
Loading…
Reference in New Issue
Block a user