Skip to content

Commit

Permalink
Skip dir size check if not enumerable (#1227)
Browse files Browse the repository at this point in the history
  • Loading branch information
vidartf committed Mar 6, 2023
1 parent d85874b commit e60b048
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
30 changes: 12 additions & 18 deletions jupyter_server/services/contents/filemanager.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/auth/test_identity.py
Expand Up @@ -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)


Expand Down

0 comments on commit e60b048

Please sign in to comment.