fix(webspace-files): unwrap daemon-wrapped data payload to prevent double-nesting - #223
Merged
NaysKutzu merged 1 commit intoSep 5, 2026
Conversation
…uble-nesting
FeatherQuilld daemon endpoints inconsistently return either a bare
payload ({"ok": true}) or wrap their entire payload in a "data" key
(list/search/pull-jobs return {"data": [...]} or
{"data": {"entries": [...]}}).
WebSpaceFilesController::daemonResponse() always forwarded the full
daemon body into ApiResponse::success(), which itself always wraps
its argument in another "data" key. For endpoints in the second
group this produced a doubly-nested {"data": {"data": [...]}}
response. The frontend reads response.data expecting the actual
list/object and got the wrapper instead, so the file manager showed
"No Files Found" even when the WebSpace had files.
Unwrap the daemon's own "data" key only when it is the sole
top-level key and itself an array, so paginated/list-style responses
collapse to a single envelope while endpoints that pair "data" with
sibling keys (e.g. "ok") or return a bare scalar under "data" (e.g.
files/contents returning file text, which the frontend already reads
as response.data.data) are left untouched.
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
NaysKutzu
approved these changes
Sep 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the WebSpace file manager showing "No Files Found" even when the
WebSpace actually contains files.
Root cause
WebSpaceFilesController::daemonResponse()always forwards the FeatherQuillddaemon's raw response body into
ApiResponse::success(). FeatherQuillddaemon endpoints are inconsistent in their own response shape:
{"ok": true}or{"ok": true, "data": {"path": "..."}}."data"key with nothing else alongside it, e.g.{"data": [...]}or{"data": {"entries": [...], "total": 4, "page": 1, "per_page": 250}}.ApiResponse::success()always wraps whatever it's given in anothertop-level
"data"key. For the second group above this produces a doublynested response:
{"data": {"data": [...]}}. The frontend readsresponse.dataexpecting the actual list/object directly, so it receivedthe wrapper object instead — resulting in an empty-looking file manager even
though the daemon returned real file entries.
Fix
Unwrap the daemon's own
"data"key indaemonResponse(), but only when:This collapses the double envelope for list/search/pull-jobs-style
responses while leaving untouched:
"data"with sibling keys (e.g.{"ok": true, "data": {...}})"data"value is a bare scalar (e.g.files/contentsreturning
{"data": "<file text>"}), which the frontend already reads asresponse.data.datafor the file editor.Testing
Reproduced and verified live against a real FeatherQuilld node + WebSpace:
GET /api/user/webspaces/{uuid}/files/list?directory=/&page=1&per_page=250returned
{"data": {"data": {"entries": [...]}}}and the file manager UIshowed "No Files Found" for a WebSpace with 4 real files.
{"data": {"entries": [...], "total": 4, ...}}and the file manager correctly lists all files.
files/contents(file editor) still works correctly (unaffected,since its daemon body's
"data"value is a scalar string).files/create-directory({"ok": true}shape) still workscorrectly and is unaffected by the unwrap condition.
files/pull-jobs({"data": {"downloads": []}}shape) unwrapscorrectly to
{"data": {"downloads": []}}with no double nesting.No automated test suite changes; this is a minimal, scoped fix to a single
private helper method used by every
WebSpaceFilesControllerdaemon-backedendpoint.