aboutsummaryrefslogtreecommitdiffstats
path: root/src/web
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2025-04-12 15:58:48 -0500
committerJP Dillingham <jp@dillingham.me>2025-04-12 15:58:48 -0500
commit3002b497f542e12f4b42eac949c3d1333932fb2a (patch)
tree811c500769e9fe7a35b857a3c3d6bf7696b0d13d /src/web
parent4d7db187c45ae651f2ee8fd3202535dc1e1818b7 (diff)
downloadslskd-3002b497f542e12f4b42eac949c3d1333932fb2a.tar.gz
update frontend to handle multiple directory responses
Diffstat (limited to 'src/web')
-rw-r--r--src/web/src/components/Search/Response.jsx8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/web/src/components/Search/Response.jsx b/src/web/src/components/Search/Response.jsx
index 40029b0c..f665c816 100644
--- a/src/web/src/components/Search/Response.jsx
+++ b/src/web/src/components/Search/Response.jsx
@@ -83,11 +83,17 @@ class Response extends Component {
const oldTree = { ...this.state.tree };
const oldFiles = oldTree[directory];
- const { files, name } = await getDirectoryContents({
+ // some clients might send more than one directory in the response,
+ // if the requested directory contains subdirectories. the root directory
+ // is always first, and for now we'll only display the contents of that.
+ const allDirectories = await getDirectoryContents({
directory,
username,
});
+ const theRootDirectory = allDirectories?.[0];
+ const { files, name } = theRootDirectory;
+
// the api returns file names only, so we need to prepend the directory
// to make it look like a search result. we also need to preserve
// any file selections, so check the old files and assign accordingly