From b6de017fcb9dbac4b64b645d21eaab467c46fbb2 Mon Sep 17 00:00:00 2001 From: Pavel Shibaev Date: Mon, 23 Sep 2024 22:04:24 +0200 Subject: [PATCH 1/4] (fix/solve) Solve ofac.json path issue --- client/chain/ofac.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/client/chain/ofac.go b/client/chain/ofac.go index 0a8b3eee..6a454ba0 100644 --- a/client/chain/ofac.go +++ b/client/chain/ofac.go @@ -7,7 +7,6 @@ import ( "net/http" "os" "path/filepath" - "strings" ) const ( @@ -41,10 +40,7 @@ func NewOfacChecker() (*OfacChecker, error) { func getOfacListPath() string { currentDirectory, _ := os.Getwd() - for !strings.HasSuffix(currentDirectory, "sdk-go") { - currentDirectory = filepath.Dir(currentDirectory) - } - return filepath.Join(filepath.Join(filepath.Join(currentDirectory, "client"), "metadata"), ofacListFilename) + return filepath.Join(currentDirectory, filepath.Join("../metadata", ofacListFilename)) } func DownloadOfacList() error { From 4700140b2087fe55aebb99c52a0e418642ea8cbf Mon Sep 17 00:00:00 2001 From: Pavel Shibaev Date: Mon, 23 Sep 2024 22:16:07 +0200 Subject: [PATCH 2/4] (fix/solve) Fix linting --- client/chain/ofac.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/chain/ofac.go b/client/chain/ofac.go index 6a454ba0..a7a586fc 100644 --- a/client/chain/ofac.go +++ b/client/chain/ofac.go @@ -40,7 +40,7 @@ func NewOfacChecker() (*OfacChecker, error) { func getOfacListPath() string { currentDirectory, _ := os.Getwd() - return filepath.Join(currentDirectory, filepath.Join("../metadata", ofacListFilename)) + return filepath.Join(currentDirectory, "..", "metadata", ofacListFilename) } func DownloadOfacList() error { From fef78fae2b795f1470b03313002e6673c08bfed0 Mon Sep 17 00:00:00 2001 From: Pavel Shibaev Date: Tue, 24 Sep 2024 16:21:01 +0200 Subject: [PATCH 3/4] (fix/solve) Fix path derivation for OFAC --- client/chain/ofac.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/client/chain/ofac.go b/client/chain/ofac.go index a7a586fc..86e79056 100644 --- a/client/chain/ofac.go +++ b/client/chain/ofac.go @@ -6,7 +6,6 @@ import ( "io" "net/http" "os" - "path/filepath" ) const ( @@ -39,8 +38,7 @@ func NewOfacChecker() (*OfacChecker, error) { } func getOfacListPath() string { - currentDirectory, _ := os.Getwd() - return filepath.Join(currentDirectory, "..", "metadata", ofacListFilename) + return getFileAbsPath(fmt.Sprintf("../metadata/%s", ofacListFilename)) } func DownloadOfacList() error { From a6ba87044455490110a55cbb4c1131b513434cf6 Mon Sep 17 00:00:00 2001 From: Pavel Shibaev Date: Wed, 25 Sep 2024 15:09:28 +0200 Subject: [PATCH 4/4] (fix/solve) Refactor to avoid using directory separator --- client/chain/ofac.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/chain/ofac.go b/client/chain/ofac.go index 86e79056..eccd14fc 100644 --- a/client/chain/ofac.go +++ b/client/chain/ofac.go @@ -6,6 +6,7 @@ import ( "io" "net/http" "os" + "path" ) const ( @@ -38,7 +39,7 @@ func NewOfacChecker() (*OfacChecker, error) { } func getOfacListPath() string { - return getFileAbsPath(fmt.Sprintf("../metadata/%s", ofacListFilename)) + return getFileAbsPath(path.Join("..", "metadata", ofacListFilename)) } func DownloadOfacList() error {