Skip to content

Commit c8e4ede

Browse files
committed
Allow filemanager to have OS path set
Will transparently convert to API path in validator.
1 parent eb31253 commit c8e4ede

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

jupyter_server/services/contents/filemanager.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from jupyter_server import _tz as tz
2222
from jupyter_server.base.handlers import AuthenticatedFileHandler
2323
from jupyter_server.transutils import _i18n
24+
from jupyter_server.utils import to_api_path
2425

2526
from .filecheckpoints import AsyncFileCheckpoints, FileCheckpoints
2627
from .fileio import AsyncFileManagerMixin, FileManagerMixin
@@ -79,6 +80,12 @@ def _default_preferred_dir(self):
7980
raise TraitError("%s is outside root contents directory" % value)
8081
return ""
8182

83+
@validate("preferred_dir")
84+
def _validate_preferred_dir(self, proposal):
85+
# It should be safe to pass an API path through this method:
86+
proposal["value"] = to_api_path(proposal["value"], self.root_dir)
87+
return super()._validate_preferred_dir(proposal)
88+
8289
@default("checkpoints_class")
8390
def _checkpoints_class_default(self):
8491
return FileCheckpoints

0 commit comments

Comments
 (0)