Skip to content

Commit

Permalink
LPD-25739 Don't escape value if the text field is an URL
Browse files Browse the repository at this point in the history
  • Loading branch information
ealonso authored and brianchandotcom committed May 21, 2024
1 parent 8f12d64 commit c594d27
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@
import com.liferay.portal.kernel.trash.TrashHandlerRegistryUtil;
import com.liferay.portal.kernel.util.DateFormatFactoryUtil;
import com.liferay.portal.kernel.util.HtmlUtil;
import com.liferay.portal.kernel.util.HttpComponentsUtil;
import com.liferay.portal.kernel.util.KeyValuePair;
import com.liferay.portal.kernel.util.LocaleUtil;
import com.liferay.portal.kernel.util.Portal;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.util.WebKeys;

import java.net.URI;
import java.net.URISyntaxException;

import java.text.DateFormat;
import java.text.ParseException;

Expand Down Expand Up @@ -433,6 +437,21 @@ else if (value instanceof String) {
else if (infoField.getInfoFieldType() instanceof
TextInfoFieldType) {

URI uri = null;

try {
uri = HttpComponentsUtil.getURI((String)value);
}
catch (URISyntaxException uriSyntaxException) {
if (_log.isDebugEnabled()) {
_log.debug(uriSyntaxException);
}
}

if (uri != null) {
return value;
}

return HtmlUtil.escape((String)value);
}

Expand Down

0 comments on commit c594d27

Please sign in to comment.