Skip to content

A folder removed on the dashboard leaves 'invalid path' for up to 5 minutes: the lookup memory is only dropped on !rehash #901

Description

@chchatzop

Follow-up to #889 (merged), from my review there.

#889 drops the #886 lookup memories on !rehash. But the dashboard's Folders and Lists pages change the library without a rehash: apply_folder_changes() / apply_list_changes() (webserver.py) call library.save_folders() / save_lists() and return, and library.folders() -> lists() -> load_lists() reads the file on every call, so the new roots are live on the next request. A path remembered under the removed folder is still on disk, passes the memory's own existence check, and is then refused by is_safe_path() against the new roots: Error: Invalid path. for a file the new configuration serves, until LOOKUP_HIT_TTL_SECONDS (5 min) passes. Reproduced through the real request path by changing library.folders the way the page's save does.

Fix: check a remembered path against the current roots where it is used - the same is_safe_path() check the request makes afterwards - and fall back to the folder memory and then the scan when it is outside them. That covers the dashboard, a hand-edited lists.json, and a scan still in flight across a rehash that records its hit after the forget. #889's rehash call stays (it also frees the memory). test_a_path_from_a_root_that_is_gone_is_refused_rather_than_served asserts the bug itself, so it flips to "served, even without a forget".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions