Skip to content

Commit

Permalink
Improve tenant context rewrite regex patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
sadilchamishka committed Oct 29, 2023
1 parent 49f0f05 commit 956761e
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ public class RewriteContext {

private Pattern baseContextPattern;

private static final String CONSOLE_CONTEXT = "/console/";

public RewriteContext(boolean isWebApp, String context) {

this.isWebApp = isWebApp;
this.context = context;
this.tenantContextPattern = Pattern.compile("^/t/([^/]+(?:/o)?)" + context);
this.tenantContextPattern = this.isWebApp ? CONSOLE_CONTEXT.equals(context)
? Pattern.compile("^/t/([^/]+)(/o|/o/([^/]+))?" + context)
: Pattern.compile("^/t/([^/]+)(/o)?" + context)
: Pattern.compile("^/t/([^/]+)" + context);
this.baseContextPattern = Pattern.compile("^" + context);
}

Expand Down

0 comments on commit 956761e

Please sign in to comment.