Skip to content

Commit 9ef85c5

Browse files
committed
feat: fix Windows path handling in ParseLocation and LoadAPISpec functions
1 parent d2f4ca7 commit 9ef85c5

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

core/dbio/connection/connection.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
cmap "github.com/orcaman/concurrent-map/v2"
1717
"github.com/samber/lo"
1818
"github.com/slingdata-io/sling-cli/core/dbio"
19+
"github.com/slingdata-io/sling-cli/core/env"
1920
"gopkg.in/yaml.v2"
2021

2122
"github.com/flarco/g"
@@ -1380,6 +1381,10 @@ func ParseLocation(location string) (conn Connection, objectExpr string, err err
13801381
return
13811382
}
13821383

1384+
if entry.Connection.Type == dbio.TypeFileLocal {
1385+
objectExpr = env.CleanWindowsPath(objectExpr) // fix windows path
1386+
}
1387+
13831388
return entry.Connection, objectExpr, nil
13841389
}
13851390

@@ -1480,6 +1485,7 @@ func LoadAPISpec(specIdentifier string) (spec api.Spec, err error) {
14801485
// load from location
14811486
case strings.HasPrefix(specIdentifier, "file://"):
14821487
specPath := strings.TrimPrefix(specIdentifier, "file://")
1488+
specPath = env.CleanWindowsPath(specPath) // fix windows path
14831489
bytes, err := os.ReadFile(specPath)
14841490
if err != nil {
14851491
return spec, g.Error(err, "could not read api spec from: %s", specPath)

0 commit comments

Comments
 (0)