Fix some issues, improve documentation
This commit is contained in:
@@ -75,7 +75,7 @@ class AbstractCommand(ABC):
|
||||
self._process_conditional_headers()
|
||||
|
||||
message = f"HTTP/1.1 {status} {status_message[status]}\r\n"
|
||||
message += self._get_date() + "\r\n"
|
||||
message += f"Date: {self._get_date()}\r\n"
|
||||
|
||||
content_length = len(body)
|
||||
message += f"Content-Length: {content_length}\r\n"
|
||||
@@ -107,7 +107,7 @@ class AbstractCommand(ABC):
|
||||
path = root + norm_path
|
||||
|
||||
if check and not os.path.exists(path):
|
||||
raise NotFound()
|
||||
raise NotFound(path)
|
||||
|
||||
return path
|
||||
|
||||
@@ -131,7 +131,7 @@ class AbstractCommand(ABC):
|
||||
return True
|
||||
|
||||
if modified <= min_date:
|
||||
raise NotModified()
|
||||
raise NotModified(f"{modified} <= {min_date}")
|
||||
|
||||
return True
|
||||
|
||||
@@ -149,11 +149,11 @@ class AbstractModifyCommand(AbstractCommand, ABC):
|
||||
|
||||
def execute(self):
|
||||
path = self._get_path(False)
|
||||
dir = os.path.dirname(path)
|
||||
directory = os.path.dirname(path)
|
||||
|
||||
if not os.path.exists(dir):
|
||||
if not os.path.exists(directory):
|
||||
raise Forbidden("Target directory does not exists!")
|
||||
if os.path.exists(dir) and not os.path.isdir(dir):
|
||||
if os.path.exists(directory) and not os.path.isdir(directory):
|
||||
raise Forbidden("Target directory is an existing file!")
|
||||
|
||||
exists = os.path.exists(path)
|
||||
|
Reference in New Issue
Block a user