Skip to content

fix: encode folder path in library folder chooser request - #5654

Open
Yi-111-a wants to merge 1 commit into
advplyr:masterfrom
Yi-111-a:fix-lazy-folder-chooser-encode-path
Open

Yi-111-a wants to merge 1 commit into
advplyr:masterfrom
Yi-111-a:fix-lazy-folder-chooser-encode-path

Conversation

@Yi-111-a

Copy link
Copy Markdown

What does this PR do?

LazyFolderChooser interpolated the selected folder path straight into the /api/filesystem query string:

.$get(`/api/filesystem?path=${path}&level=${level}`)

A folder whose name contains & (also #, +) produced a request like ?path=H:/Audio & Books&level=1. The & terminates the path parameter, so the server only sees path=H:/Audio — a non-existent relative path — and answers 400 Invalid "path" query string. The UI then shows the "Failed to load data" toast and the subfolders never load.

Encoding the value with encodeURIComponent keeps the path in a single parameter. The server already receives a decoded value, because FileSystemController.getPaths reads req.query.path from Express' query parser, so no server-side change is needed.

This matches how the rest of the client builds query strings (e.g. search.vue, GlobalSearch.vue, Match.vue).

Where to review

client/components/modals/libraries/LazyFolderChooser.vue — single line, in fetchDirs.

Testing

  • Verified the failing request shape: GET /api/filesystem?path=H:/Audio & Books&level=1 → 400.
  • With encodeURIComponent, the same server returns the subfolders for a folder named Audio & Books.
  • Client lint is clean (the client/ tree is covered by the repo's eslint ignore patterns, so no lint config changes are needed).

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Folder chooser shows "Failed to load data" for folder names containing & # + (path not URL-encoded)

1 participant