Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: file path inclusion #57

Merged
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
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
Loading