From b6d46ea1bf5b3b78539c5c3c9488e739a532d1b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Sun, 25 Apr 2021 18:29:00 +0200 Subject: [PATCH] return bytes --- server/executor.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/executor.py b/server/executor.py index b28379d..5c67947 100644 --- a/server/executor.py +++ b/server/executor.py @@ -72,11 +72,14 @@ class Executor: f.close() return currenctfile - def getFileInCurrentDirectory(self, file: str): + def getFileInCurrentDirectory(self, file: str) -> bytes: file = self.sanitizeFile(file) currentfile = os.path.join(self.currentDirectory, file) if os.path.exists(currentfile): - return open(currentfile, "r") + f = open(currentfile, "rb") + content = f.read() + f.close() + return content else: raise Exception('File not found')