PR feedback

This commit is contained in:
Fabian Jakobs 2024-09-04 13:56:36 +02:00
parent 4c9bf79c76
commit 694413b115
No known key found for this signature in database
1 changed files with 8 additions and 4 deletions

View File

@ -11,6 +11,7 @@ import (
"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/filer"
"github.com/databricks/cli/libs/log"
"github.com/databricks/cli/libs/notebook"
"github.com/databricks/cli/libs/runtime"
"github.com/databricks/databricks-sdk-go/service/workspace"
@ -110,11 +111,14 @@ func (f *inMemoryFile) PersistToDisk() error {
func shouldUseImportNotebook(ctx context.Context, path string, content []byte) bool {
if strings.HasPrefix(path, "/Workspace/") && runtime.RunsOnDatabricks(ctx) {
isNotebook, _, _ := notebook.DetectWithContent(path, content)
return isNotebook
} else {
return false
isNotebook, _, err := notebook.DetectWithContent(path, content)
if err != nil {
log.Debugf(ctx, "Error detecting notebook: %v", err)
}
return isNotebook && err != nil
}
return false
}
func writeFile(ctx context.Context, path string, content []byte, perm fs.FileMode) error {