Skip to content

Commit d0a9eb1

Browse files
authored
Fix import-dir logging for notebooks in subdirectories on Windows (#4250)
## Changes When importing notebooks from subdirectories on Windows, the log output showed incorrect paths with backslashes instead of forward slashes. Example buggy output: ``` subdir\nested\notebook.py -> /Users/.../subdir\nested\notebook ``` Expected output: ``` subdir\nested\notebook.py -> /Users/.../subdir/nested/notebook ``` The bug was in lines 74-75 of import_dir.go where path.Ext() and strings.TrimSuffix() operated on localName (with backslashes) instead of remoteName (already converted to forward slashes via filepath.ToSlash). ## Why Found this while investigating the `TestImportDir` failures. ## Tests Tested on Windows 10 (10.0.26100.7462) with nested notebook files. Root-level notebooks were unaffected. The actual import operation worked correctly in both versions - only log output was impacted.
1 parent 35e5b2c commit d0a9eb1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/workspace/workspace/import_dir.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ func (opts importDirOptions) callback(ctx context.Context, workspaceFiler filer.
7171
return err
7272
}
7373
if isNotebook {
74-
ext := path.Ext(localName)
75-
remoteName = strings.TrimSuffix(localName, ext)
74+
ext := path.Ext(remoteName)
75+
remoteName = strings.TrimSuffix(remoteName, ext)
7676
}
7777

7878
// Open the local file

0 commit comments

Comments
 (0)