From ac0327dc33000701169bbd508be33b3642bc685b Mon Sep 17 00:00:00 2001 From: huyhuynh3103 Date: Thu, 10 Oct 2024 15:03:13 +0700 Subject: [PATCH] fix: LibInitializeGuard --- script/libraries/LibInitializeGuard.sol | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/script/libraries/LibInitializeGuard.sol b/script/libraries/LibInitializeGuard.sol index a4f6962..aa70acc 100644 --- a/script/libraries/LibInitializeGuard.sol +++ b/script/libraries/LibInitializeGuard.sol @@ -340,9 +340,12 @@ library LibInitializeGuard { string memory path ) internal pure returns (string memory contractName) { uint256 length = bytes(path).length; - // Remove ".sol" + contractName = path; if (path.endsWith(".sol")) contractName = path.slice(0, length - 4); - return string(contractName); + string[] memory parts = contractName.split(":"); + if (parts.length != 0) contractName = parts[parts.length - 1]; + parts = contractName.split("/"); + if (parts.length != 0) contractName = parts[parts.length - 1]; } /**