diff --git a/src/inmanta/server/server.py b/src/inmanta/server/server.py index 751e9f59ee..8c925eebd2 100644 --- a/src/inmanta/server/server.py +++ b/src/inmanta/server/server.py @@ -562,7 +562,7 @@ def get_file_internal(self, file_hash): file_name = os.path.join(self._server_storage["files"], file_hash) if not os.path.exists(file_name): - return 404 + return 404, None else: with open(file_name, "rb") as fd: diff --git a/tests/test_protocol.py b/tests/test_protocol.py index 7c952a7046..e3f8aee32a 100644 --- a/tests/test_protocol.py +++ b/tests/test_protocol.py @@ -66,6 +66,15 @@ def test_client_files(client): assert result.result["content"] == body +@pytest.mark.gen_test +def test_client_files_lost(client): + (hash, content, body) = make_random_file() + + # Get the file + result = yield client.get_file(id=hash) + assert result.code == 404 + + @pytest.mark.gen_test def test_sync_client_files(client): done = []