Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -856,9 +856,11 @@ public static String getBasePath(String tenantDomain, String context, boolean is
} else if (basePath != null && basePath.contains(FrameworkConstants.ORGANIZATION_CONTEXT_PREFIX)) {
String organizationId = PrivilegedCarbonContext.getThreadLocalCarbonContext()
.getOrganizationId();
basePath = basePath.replace(
FrameworkConstants.ORGANIZATION_CONTEXT_PREFIX + organizationId,
FrameworkConstants.TENANT_CONTEXT_PREFIX + tenantDomain);
if (organizationId != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we use StringUtils? WDYT?

basePath = basePath.replace(
FrameworkConstants.ORGANIZATION_CONTEXT_PREFIX + organizationId,
FrameworkConstants.TENANT_CONTEXT_PREFIX + tenantDomain);
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] While the null check is a good defensive measure, consider adding debug logging when organizationId is null to aid troubleshooting. This would help identify scenarios where the basePath rewrite is skipped unexpectedly. For example:

if (organizationId != null) {
    basePath = basePath.replace(
            FrameworkConstants.ORGANIZATION_CONTEXT_PREFIX + organizationId,
            FrameworkConstants.TENANT_CONTEXT_PREFIX + tenantDomain);
} else {
    if (log.isDebugEnabled()) {
        log.debug("Organization ID is null. Skipping basePath rewrite for organization context.");
    }
}
Suggested change
FrameworkConstants.TENANT_CONTEXT_PREFIX + tenantDomain);
FrameworkConstants.TENANT_CONTEXT_PREFIX + tenantDomain);
} else {
// Organization ID is null. Skipping basePath rewrite for organization context.
if (log.isDebugEnabled()) {
log.debug("Organization ID is null. Skipping basePath rewrite for organization context.");
}

Copilot uses AI. Check for mistakes.
}
}
} else {
serverUrl = ServiceURLBuilder.create().build().getAbsoluteInternalURL();
Expand Down
Loading