check Drafty for validity
This commit is contained in:
@@ -81,7 +81,7 @@ export default class ChatMessage extends React.Component {
|
|||||||
|
|
||||||
let content = this.props.content;
|
let content = this.props.content;
|
||||||
const attachments = [];
|
const attachments = [];
|
||||||
if (this.props.mimeType == Drafty.getContentType()) {
|
if (this.props.mimeType == Drafty.getContentType() && Drafty.isValid(content)) {
|
||||||
Drafty.attachments(content, function(att, i) {
|
Drafty.attachments(content, function(att, i) {
|
||||||
if (att.mime == 'application/json') {
|
if (att.mime == 'application/json') {
|
||||||
// Don't show json objects as attachments.
|
// Don't show json objects as attachments.
|
||||||
@@ -106,10 +106,11 @@ export default class ChatMessage extends React.Component {
|
|||||||
defaultMessage="content deleted" description="Shown when messages are deleted" />
|
defaultMessage="content deleted" description="Shown when messages are deleted" />
|
||||||
</i></>
|
</i></>
|
||||||
} else if (typeof content != 'string') {
|
} else if (typeof content != 'string') {
|
||||||
content = <><i className="material-icons gray">error_outline</i> <i className="gray">
|
content = <>
|
||||||
<FormattedMessage id="invalid_content"
|
<i className="material-icons gray">error_outline</i> <i className="gray">
|
||||||
defaultMessage="invalid content" description="Shown when message is unreadable" />
|
<FormattedMessage id="invalid_content"
|
||||||
</i></>
|
defaultMessage="invalid content" description="Shown when message is unreadable" /></i>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+1
-1
@@ -7093,7 +7093,7 @@ var ChatMessage = function (_React$Component) {
|
|||||||
var content = this.props.content;
|
var content = this.props.content;
|
||||||
var attachments = [];
|
var attachments = [];
|
||||||
|
|
||||||
if (this.props.mimeType == tinode_sdk__WEBPACK_IMPORTED_MODULE_2__["Drafty"].getContentType()) {
|
if (this.props.mimeType == tinode_sdk__WEBPACK_IMPORTED_MODULE_2__["Drafty"].getContentType() && tinode_sdk__WEBPACK_IMPORTED_MODULE_2__["Drafty"].isValid(content)) {
|
||||||
tinode_sdk__WEBPACK_IMPORTED_MODULE_2__["Drafty"].attachments(content, function (att, i) {
|
tinode_sdk__WEBPACK_IMPORTED_MODULE_2__["Drafty"].attachments(content, function (att, i) {
|
||||||
if (att.mime == 'application/json') {
|
if (att.mime == 'application/json') {
|
||||||
return;
|
return;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+87
-49
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user