fix: plugins: config.real_path with files:false was still showing files

Massimo Melina committed Mar 29, 2025 at 12:03 UTC 264e3fa2dfa1f3d0622cef0ba392544119a1a9cf
2 files changed +4 -3
admin/src/FilePicker.ts
+3 -2
@@ -63,8 +63,9 @@ export default function FilePicker({ onSelect, multiple=true, files=true, folder
63 if (!v)
64 return setCwd(root)
65 const res = await apiCall('resolve_path', { path: v })
66 - if (res.isFolder === false)
67 - return files ? onSelect([v]) : setCwd(v.slice(0, -basename(v)))
66 + if (res.isFolder === false) // the user entered a path to a file
67 + return files ? onSelect([v]) // select it, if files are allowed
68 + : setCwd(v.slice(0, -basename(v).length-1)) // otherwise consider its folder
69 setCwd(res.path)
70 },
71 end: h(Fragment, {},
src/api.vfs.ts
+1 -1
@@ -187,7 +187,7 @@ const apis: ApiHandlers = {
187
188 get_disk_spaces: getDiskSpaces,
189
190 - get_ls({ path, files=true, fileMask }, ctx) {
190 + get_ls({ path, files, fileMask }, ctx) {
191 return new SendListReadable<LsEntry>({
192 async doAtStart(list) {
193 if (!path && IS_WINDOWS) {