Skip to content

browse: Fix an error when browsing content by id with breadcrumbs

When browsing a content by its sha1_git identifier, the identifier of the directory containing it is prepended to the path query parameter in order to display a functional breadcrumbs enabling to navigate back and forth in a filsystem.

However, when an origin context is provided through the origin_url query parameter of the content view, the previous implementation was using the root directory identifier of the head branch of the latest origin snapshot in the breadcrumbs instead of the one provided in the path query parameter. This could lead to a 404 error as the wrong root directory was used to query subpaths in the breadcrumbs.

See https://webapp.staging.swh.network/browse/directory/a855286ffc61aeab2cd9b385157af4a24327093d/?origin_url=rpm://Fedora/packages/python-nltk_lite&path=nltk-0.9b2/nltk/draw for instance, trying to browse any file raises a 404.

Merge request reports