1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-01 04:43:29 +03:00

don't log verification validation errors for normal messages

This commit is contained in:
Bruno Windels
2020-01-24 12:23:18 +01:00
parent 468fb2cc41
commit 583df7ed7d
2 changed files with 10 additions and 6 deletions

View File

@@ -128,11 +128,13 @@ export class InRoomChannel {
static validateEvent(event, client) { static validateEvent(event, client) {
const txnId = InRoomChannel.getTransactionId(event); const txnId = InRoomChannel.getTransactionId(event);
if (typeof txnId !== "string" || txnId.length === 0) { if (typeof txnId !== "string" || txnId.length === 0) {
logger.log("InRoomChannel: validateEvent: no valid txnId " + txnId);
return false; return false;
} }
const type = InRoomChannel.getEventType(event); const type = InRoomChannel.getEventType(event);
const content = event.getContent(); const content = event.getContent();
// from here on we're fairly sure that this is supposed to be
// part of a verification request, so be noisy when rejecting something
if (type === REQUEST_TYPE) { if (type === REQUEST_TYPE) {
if (!content || typeof content.to !== "string" || !content.to.length) { if (!content || typeof content.to !== "string" || !content.to.length) {
logger.log("InRoomChannel: validateEvent: " + logger.log("InRoomChannel: validateEvent: " +

View File

@@ -82,13 +82,15 @@ export class VerificationRequest extends EventEmitter {
static validateEvent(type, event, client) { static validateEvent(type, event, client) {
const content = event.getContent(); const content = event.getContent();
if (!content) {
logger.log("VerificationRequest: validateEvent: no content");
}
if (!type.startsWith(EVENT_PREFIX)) { if (!type.startsWith(EVENT_PREFIX)) {
logger.log("VerificationRequest: validateEvent: " + return false;
"fail because type doesnt start with " + EVENT_PREFIX); }
// from here on we're fairly sure that this is supposed to be
// part of a verification request, so be noisy when rejecting something
if (!content) {
logger.log("VerificationRequest: validateEvent: no content");
return false; return false;
} }