binhuiliu opened a new issue, #12289:
URL: https://github.com/apache/gravitino/issues/12289
## Version
Apache Gravitino 1.3.0, commit `40fdf6ab96ac87b47e6d3e14e7c4dc0d815e68f0`.
## Describe what's wrong
When a user browses into a nested directory of one fileset and then selects
another fileset in the Web UI, the files view retains the previous fileset's
current path.
The UI consequently requests the newly selected fileset with a `sub_path`
that belongs to the previously selected fileset. The server rejects the request
with HTTP 400 because the resolved path is outside the selected fileset's
storage location.
The server-side validation appears to be working as intended. The incorrect
request is produced by stale state in the Web UI.
## Error message and/or stacktrace
Example request sequence, with generic names:
```text
1. Open fileset_a and navigate to:
/department/training/records/2026
2. Select fileset_b.
3. The Web UI sends a request equivalent to:
GET .../filesets/fileset_b/list?sub_path=/department/training/records/2026
4. The server responds with HTTP 400 / IllegalArgumentException because that
path is not under fileset_b's storage location.
```
This was reproduced when switching among several filesets, so it is not
specific to one fileset or one directory.
## How to reproduce
1. Create two filesets whose storage locations are different.
2. Add a nested directory under the first fileset.
3. Open the first fileset in the Web UI.
4. Navigate into the nested directory so the current path is no longer `/`.
5. Without navigating back to the root, select the second fileset in the
metadata tree.
6. Observe that the files request for the second fileset still contains the
path selected under the first fileset.
Expected behavior:
- Selecting a different fileset starts browsing from that fileset's root
path (`/`).
- Path history and file-list pagination correspond to the newly selected
fileset.
- No request for the new fileset is sent with the previous fileset's path.
Actual behavior:
- The current path from the previous fileset is reused.
- The server returns HTTP 400 for the invalid fileset/path combination.
## Additional context
The relevant component is:
```text
web/web/src/app/metalakes/metalake/rightContent/tabsContent/filesetView/FilesetView.js
```
It stores navigation state locally:
```js
const [currentPath, setCurrentPath] = useState('/')
const [pathHistory, setPathHistory] = useState(['/'])
```
The file-list request effect depends on both `fileset` and `currentPath` and
passes `currentPath` as `subPath`. However, there is no corresponding reset of
`currentPath`, `pathHistory`, or pagination when the fileset identity changes.
Since React preserves the mounted component state, changing the selected
fileset can trigger a request using the old path.
A fix should also ensure that changing filesets does not issue an
intermediate request with the stale path before the reset takes effect.
This report concerns the Web UI state lifecycle only. It does not propose
weakening the server-side fileset path validation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]