Skip to content

Commit

Permalink
CB-4696 truncate content string value fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yagudin10 committed Mar 6, 2024
1 parent 9934ed9 commit 0792dbc
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ private static Object serializeContentValue(WebSession session, DBDContent value
Map<String, Object> map = createMapOfType(WebSQLConstants.VALUE_TYPE_CONTENT);
if (ContentUtils.isTextContent(value)) {
String stringValue = ContentUtils.getContentStringValue(session.getProgressMonitor(), value);
int textPreviewMaxLength = CommonUtils.toInt(
CBApplication.getInstance().getAppConfiguration().getResourceQuota(
WebSQLConstants.QUOTA_PROP_TEXT_PREVIEW_MAX_LENGTH,
WebSQLConstants.TEXT_PREVIEW_MAX_LENGTH));
if (stringValue != null && stringValue.length() > textPreviewMaxLength) {
stringValue = stringValue.substring(0, textPreviewMaxLength);
}
map.put(WebSQLConstants.ATTR_TEXT, stringValue);
} else {
map.put(WebSQLConstants.ATTR_BINARY, true);
Expand Down

0 comments on commit 0792dbc

Please sign in to comment.