Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nextchanges/bundles/notebook-path-with-colon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Fix bundle commands failing on a notebook or file path with a colon in its first segment, such as the default workspace notebook name `New Notebook 2026-10-28 12:17:43.ipynb`. ([#7851](https://github.com/databricks/cli/pull/7851))
11 changes: 11 additions & 0 deletions acceptance/bundle/paths/notebook_name_with_colon/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
bundle:
name: notebook_name_with_colon

resources:
jobs:
job:
name: job
tasks:
- task_key: task
notebook_task:
notebook_path: New Notebook 12:17:43.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Cloud = false
GOOS.windows = false
EnvMatrix.DMS = ["", "true"]
3 changes: 3 additions & 0 deletions acceptance/bundle/paths/notebook_name_with_colon/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

>>> [CLI] bundle validate -o json
"/Workspace/Users/[USERNAME]/.bundle/notebook_name_with_colon/default/files/New Notebook 12:17:43"
4 changes: 4 additions & 0 deletions acceptance/bundle/paths/notebook_name_with_colon/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Windows does not allow colons in file names, so the notebook is not committed.
echo '{"cells": [], "metadata": {}, "nbformat": 4, "nbformat_minor": 0}' > "New Notebook 12:17:43.ipynb"
trace $CLI bundle validate -o json | jq '.resources.jobs.job.tasks[0].notebook_task.notebook_path'
rm "New Notebook 12:17:43.ipynb"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GOOS.windows = false
10 changes: 3 additions & 7 deletions bundle/config/mutator/normalize_paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,9 @@ func normalizePath(path string, location diag.Location, bundleRootPath string) (
}
}

pathAsUrl, err := url.Parse(path)
if err != nil {
return "", err
}

// if path has scheme, it's a full path and doesn't need to be relativized
if pathAsUrl.Scheme != "" {
// if path has scheme, it's a full path and doesn't need to be relativized.
// A path that is not a valid URL, such as "New Notebook 12:17:43.ipynb", is a local path.
if pathAsUrl, err := url.Parse(path); err == nil && pathAsUrl.Scheme != "" {
return path, nil
}

Expand Down
10 changes: 3 additions & 7 deletions bundle/config/mutator/translate_paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,9 @@ func (t *translateContext) rewritePath(
return "", nil
}

url, err := url.Parse(input)
if err != nil {
return "", err
}

// If the file path has scheme, it's a full path and we don't need to transform it
if url.Scheme != "" {
// If the file path has scheme, it's a full path and we don't need to transform it.
// A path that is not a valid URL, such as "New Notebook 12:17:43.ipynb", is a local path.
if u, err := url.Parse(input); err == nil && u.Scheme != "" {
return "", nil
}

Expand Down
Loading