Skip to content

Commit

Permalink
Try to fix local file lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
jtdoepke committed Jan 24, 2024
1 parent e717702 commit 3832929
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/swagger/load.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package swagger

import (
"fmt"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"strings"
)

Expand All @@ -15,8 +17,13 @@ func Load(loader Loader, url string) (Definitions, error) {
var data []byte
if strings.HasPrefix(url, "file://") {
path := strings.TrimPrefix(url, "file://")

var err error
path, err = filepath.Abs(path)
if err != nil {
cwd, _ := os.Getwd()
fmt.Print(cwd)
return nil, err
}
data, err = os.ReadFile(path)
if err != nil {
return nil, err
Expand Down

0 comments on commit 3832929

Please sign in to comment.