Skip to content

Commit e60b048

Browse files
authored
Skip dir size check if not enumerable (#1227)
1 parent d85874b commit e60b048

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

jupyter_server/services/contents/filemanager.py

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -702,15 +702,12 @@ def _get_dir_size(self, path="."):
702702

703703
self.log.info(f"current status of du command {result}")
704704
size = result[0].decode("utf-8")
705-
except Exception as err:
706-
self.log.error(f"Error during directory copy: {err}")
707-
raise web.HTTPError(
708-
400,
709-
f"""
710-
Unexpected error during copy operation,
711-
not able to get the size of the {path} directory
712-
""",
713-
) from err
705+
except Exception:
706+
self.log.warning(
707+
"Not able to get the size of the %s directory. Copying might be slow if the directory is large!",
708+
path,
709+
)
710+
return "0"
714711
return size
715712

716713
def _human_readable_size(self, size):
@@ -1180,15 +1177,12 @@ async def _get_dir_size(self, path: str = ".") -> str:
11801177

11811178
self.log.info(f"current status of du command {result}")
11821179
size = result[0].decode("utf-8")
1183-
except Exception as err:
1184-
self.log.error(f"Error during directory copy: {err}")
1185-
raise web.HTTPError(
1186-
400,
1187-
f"""
1188-
Unexpected error during copy operation,
1189-
not able to get the size of the {path} directory
1190-
""",
1191-
) from err
1180+
except Exception:
1181+
self.log.warning(
1182+
"Not able to get the size of the %s directory. Copying might be slow if the directory is large!",
1183+
path,
1184+
)
1185+
return "0"
11921186
return size
11931187

11941188
async def _human_readable_size(self, size: int) -> str:

tests/auth/test_identity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def test_password_required(identity_provider_class, password_set, password_requi
174174
app.identity_provider = idp
175175
ctx = nullcontext() if ok else pytest.raises(SystemExit)
176176

177-
with ctx: # type:ignore[attr-defined]
177+
with ctx:
178178
idp.validate_security(app, ssl_options=None)
179179

180180

0 commit comments

Comments
 (0)