Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: regex max stack depth crash #2789

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion package/src/components/Channel/Channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ const ChannelWithContext = <
MessageStatus = MessageStatusDefault,
MessageSystem = MessageSystemDefault,
MessageText,
messageTextNumberOfLines = 5,
isekovanic marked this conversation as resolved.
Show resolved Hide resolved
messageTextNumberOfLines,
MessageTimestamp = MessageTimestampDefault,
MessageUserReactions = MessageUserReactionsDefault,
MessageUserReactionsAvatar = MessageUserReactionsAvatarDefault,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,11 @@ export const generateMarkdownText = (text?: string) => {

resultText = resultText.replace(/[<"'>]/g, '\\$&');

// Remove whitespaces that come directly after newlines except in code blocks where we deem this allowed.
resultText = resultText.replace(/(```[\s\S]*?```|`.*?`)|\n[ ]{2,}/g, (_, code) => {
if (code) return code;
return '\n';
});

return resultText;
};
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,12 @@ exports[`Thread should match thread snapshot 1`] = `
}
>
<Text
numberOfLines={5}
style={
{
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
"justifyContent": "flex-start",
"marginBottom": 8,
"marginTop": 8,
}
Expand Down Expand Up @@ -823,9 +826,12 @@ exports[`Thread should match thread snapshot 1`] = `
}
>
<Text
numberOfLines={5}
style={
{
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
"justifyContent": "flex-start",
"marginBottom": 8,
"marginTop": 8,
}
Expand Down Expand Up @@ -1171,9 +1177,12 @@ exports[`Thread should match thread snapshot 1`] = `
}
>
<Text
numberOfLines={5}
style={
{
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
"justifyContent": "flex-start",
"marginBottom": 8,
"marginTop": 8,
}
Expand Down Expand Up @@ -1553,9 +1562,12 @@ exports[`Thread should match thread snapshot 1`] = `
}
>
<Text
numberOfLines={5}
style={
{
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
"justifyContent": "flex-start",
"marginBottom": 8,
"marginTop": 8,
}
Expand Down
Loading