Repository navigation
Fix Studio custom folders on Linux external drives - #6799
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for Linux external media mount paths (specifically under /run/media/<user>/<volume>) in the folder browser and scan folder utilities. It adds helper functions to detect and list these paths, updates the folder browser allowlist and validation logic to permit them, and includes comprehensive unit tests. The feedback suggests specifying encoding="utf-8" when reading files in the test suite to ensure cross-platform compatibility.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e353f7fee8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c113a3513e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Thanks for the fix. The The legacy The commit:
Tests on the branch: One request: could you rebase onto the latest |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b0c4f9b400
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…i#6799 The legacy /api/models browse endpoint gained the new /run/media mount roots in its allowlist but not the credential/config guard that scan-folder registration and the Hub browser already enforce. Filter sensitive names during enumeration and reject them in _resolve_browse_target so .ssh, .aws, .config, etc. under allowlisted roots stay unbrowseable, matching the Hub browser. Add a public contains_sensitive_path_component helper and cover the legacy resolver with a regression test.
19633c6 to
e63838a
Compare
Both _resolve_browse_target functions only checked contains_sensitive_path_component while walking descendant parts, so requesting an allowlisted root itself (empty relative path) returned it unchecked. A pre-existing scan-folder row under ~/.ssh, ~/.aws, ~/.config, etc. (registerable before the denylist was added) is re-added to the allowlist on upgrade and could then be browsed. Check the resolved target once before returning in both the legacy and Hub browsers, and cover the root case in both test suites.
|
Thanks for the rebase and the I pushed one more commit (13e8270) to close the related root-level hole that lives in the resolver rather than the media helper. Both The fix checks the resolved target once before returning, in both the legacy Tests: Remaining nits, both optional and non-blocking: the legacy |
|
Thanks Daniel that makes sense. I agree with your suggestion on leaving the parity nits alone. Appreciate you tightening the root browse case and running the extra tests. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Added a targeted repro run here: https://github.com/Imagineer99/unsloth/actions/runs/28674767655 It covers the original Linux external-drive case and confirms the existing Focused tests passed:
|
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |

Summary
Fixes #6798.
Unsloth Studio rejected Custom Folder paths on Linux external drives mounted under:
The reported issue shows a model folder under
/run/media/dspofu/...failing with:The root cause was not model scanning itself. The path was blocked before scanning because scan-folder validation treated every path under
/runas unsafe, including valid removable-media mount points created by Linux desktop environments.This PR allows valid Linux external-drive model folders under
/run/media/<user>/<volume>/...while keeping the rest of/runblocked.Findings
I traced the Custom Folder flow end-to-end:
The important difference is:
/run/media/<user>/<volume>/models/...failed during scan-folder registration because the broad/rundenylist rejected it/run/media/$USER/<volume>mount root included in the folder-browser allowlist, otherwise the picker could not reliably reach itSo this fix covers both backend paths involved in Custom Folder usage:
What changed
/run/media/<user>/<volume>/..../run/media/<user>/<volume>/...paths./runpaths blocked, including:/run/run/media/run/media/<user>/run/user/.../run/systemd/.../run/*/run/media/$USER/*volume roots to the Custom Folder browser allowlist./api/modelspaths because the shared Studio folder browser still uses the legacy browse endpoint./runcases.Safety
This does not broadly allow
/run.The exception is intentionally narrow: only Linux removable-media mount paths shaped like:
Existing protections remain in place:
.ssh,.aws,.configThis keeps the original security intent of blocking system runtime paths while allowing the specific external-drive layout shown in the bug report.
Tests
Manual Linux UI verification was not performed locally because this was developed on macOS. The focused backend tests cover the exact reported
/run/media/<user>/<volume>/...policy, plus both paste-path registration and browse allowlist resolution.