diff --git a/jupyter_server/services/contents/filemanager.py b/jupyter_server/services/contents/filemanager.py index 83eefce397..73a44901dd 100644 --- a/jupyter_server/services/contents/filemanager.py +++ b/jupyter_server/services/contents/filemanager.py @@ -702,15 +702,12 @@ def _get_dir_size(self, path="."): self.log.info(f"current status of du command {result}") size = result[0].decode("utf-8") - except Exception as err: - self.log.error(f"Error during directory copy: {err}") - raise web.HTTPError( - 400, - f""" - Unexpected error during copy operation, - not able to get the size of the {path} directory - """, - ) from err + except Exception: + self.log.warning( + "Not able to get the size of the %s directory. Copying might be slow if the directory is large!", + path, + ) + return "0" return size def _human_readable_size(self, size): @@ -1180,15 +1177,12 @@ async def _get_dir_size(self, path: str = ".") -> str: self.log.info(f"current status of du command {result}") size = result[0].decode("utf-8") - except Exception as err: - self.log.error(f"Error during directory copy: {err}") - raise web.HTTPError( - 400, - f""" - Unexpected error during copy operation, - not able to get the size of the {path} directory - """, - ) from err + except Exception: + self.log.warning( + "Not able to get the size of the %s directory. Copying might be slow if the directory is large!", + path, + ) + return "0" return size async def _human_readable_size(self, size: int) -> str: diff --git a/tests/auth/test_identity.py b/tests/auth/test_identity.py index 7e836d47f9..9c4010f445 100644 --- a/tests/auth/test_identity.py +++ b/tests/auth/test_identity.py @@ -174,7 +174,7 @@ def test_password_required(identity_provider_class, password_set, password_requi app.identity_provider = idp ctx = nullcontext() if ok else pytest.raises(SystemExit) - with ctx: # type:ignore[attr-defined] + with ctx: idp.validate_security(app, ssl_options=None)