Skip to content

Commit

Permalink
LPD-44278 Fix rename
Browse files Browse the repository at this point in the history
  • Loading branch information
victorg1991 authored and brianchandotcom committed Jan 2, 2025
1 parent 67cee50 commit 258b446
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.liferay.petra.string.StringPool;

import java.util.Map;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -408,14 +409,16 @@ public static String escapeJSLink(String link) {
}

String protocol = StringUtil.toLowerCase(
link.substring(index - 10, pos));
link.substring(index - 10, index));

if (!Objects.equals(protocol, "javascript")) {
return link;
}

return link.substring(0, pos) +
StringUtil.replaceFirst(link.substring(pos), CharPool.COLON, "%3a");
String escapedLinkPart = StringUtil.replaceFirst(
link.substring(index), CharPool.COLON, "%3a");

return link.substring(0, index) + escapedLinkPart;
}

/**
Expand Down

0 comments on commit 258b446

Please sign in to comment.