Skip to content

Commit

Permalink
Merge pull request #57 from babylonlabs-io/fix-path-inclusion-and-cat…
Browse files Browse the repository at this point in the history
…ch-healthcheck-error

fix: file path inclusion
  • Loading branch information
jrwbabylonlab authored Sep 4, 2024
2 parents 9559ba3 + 1eba8ea commit 948c4ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions internal/types/finality_providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package types
import (
"encoding/json"
"os"
"path/filepath"
)

type FinalityProviderDescription struct {
Expand Down Expand Up @@ -30,8 +31,8 @@ type FinalityProviders struct {
FinalityProviders []FinalityProviderFromFile `json:"finality_providers"`
}

func NewFinalityProviders(filePath string) ([]FinalityProviderDetails, error) {
data, err := os.ReadFile(filePath)
func NewFinalityProviders(path string) ([]FinalityProviderDetails, error) {
data, err := os.ReadFile(filepath.Clean(path))
if err != nil {
return nil, err
}
Expand Down
5 changes: 3 additions & 2 deletions internal/types/global_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/hex"
"encoding/json"
"os"
"path/filepath"

"github.com/babylonlabs-io/networks/parameters/parser"
"github.com/btcsuite/btcd/btcec/v2"
Expand All @@ -13,8 +14,8 @@ type VersionedGlobalParams = parser.VersionedGlobalParams

type GlobalParams = parser.GlobalParams

func NewGlobalParams(filePath string) (*GlobalParams, error) {
data, err := os.ReadFile(filePath)
func NewGlobalParams(path string) (*GlobalParams, error) {
data, err := os.ReadFile(filepath.Clean(path))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 948c4ab

Please sign in to comment.