fix(dashboard): keep local file browser on home

This commit is contained in:
Teknium 2026-06-13 05:23:01 -07:00
parent 16fb573bae
commit d206e1f51d
2 changed files with 33 additions and 1 deletions

View file

@ -193,6 +193,33 @@ def test_local_mode_defaults_to_home_and_can_jump_to_absolute_path(local_files_c
assert other_listing.json()["entries"][0]["path"] == str(other / "other.txt")
def test_gated_local_mode_still_defaults_to_home(monkeypatch, tmp_path):
home = tmp_path / "home"
home.mkdir()
monkeypatch.delenv("HERMES_DASHBOARD_FILES_ROOT", raising=False)
monkeypatch.delenv("HERMES_MANAGED", raising=False)
monkeypatch.setenv("HOME", str(home))
monkeypatch.setenv("HERMES_HOME", str(home / ".hermes"))
prev_auth_required = getattr(web_server.app.state, "auth_required", None)
prev_bound_host = getattr(web_server.app.state, "bound_host", None)
web_server.app.state.auth_required = True
web_server.app.state.bound_host = "0.0.0.0"
try:
request = SimpleNamespace(
app=web_server.app,
client=SimpleNamespace(host="10.0.0.2"),
url=SimpleNamespace(hostname="example.com"),
)
policy = web_server._managed_files_policy(request, create_root=False)
finally:
_restore_app_state(prev_auth_required, prev_bound_host)
assert policy.default_path == home.resolve()
assert policy.locked_root is None
assert policy.can_change_path is True
def test_local_mode_upload_read_mkdir_delete_roundtrip(local_files_client):
client, home = local_files_client
folder = home / "workspace"