From f3a167aff232635c4fd8bff7b5dd4c81c1d71b51 Mon Sep 17 00:00:00 2001 From: leovct Date: Fri, 29 Nov 2024 13:22:46 +0100 Subject: [PATCH] fix: importing package with same prefix name --- .../startosis_packages/git_package_content_provider/locators.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/locators.go b/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/locators.go index bed6d7baa3..3ddc1dedad 100644 --- a/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/locators.go +++ b/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/locators.go @@ -20,6 +20,8 @@ func isLocalLocator(locator string) bool { } func shouldBlockAbsoluteLocatorBecauseIsInTheSameSourceModuleLocatorPackage(relativeOrAbsoluteLocator string, sourceModuleLocator string, rootPackageId string) bool { + // Make sure the root package id ends with a trailing slash. + rootPackageId = strings.TrimPrefix(rootPackageId, "/") + "/" isSourceModuleInRootPackage := strings.HasPrefix(sourceModuleLocator, rootPackageId) isAbsoluteLocatorInRootPackage := strings.HasPrefix(relativeOrAbsoluteLocator, rootPackageId) return isSourceModuleInRootPackage && isAbsoluteLocatorInRootPackage