Always look at the same literal data packet in getText() and verify()
This commit is contained in:
parent
8720adcf65
commit
e727097bb0
|
@ -244,7 +244,8 @@ Message.prototype.decryptSessionKeys = async function(privateKeys, passwords) {
|
||||||
* @returns {(Uint8Array|null)} literal body of the message as Uint8Array
|
* @returns {(Uint8Array|null)} literal body of the message as Uint8Array
|
||||||
*/
|
*/
|
||||||
Message.prototype.getLiteralData = function() {
|
Message.prototype.getLiteralData = function() {
|
||||||
const literal = this.packets.findPacket(enums.packet.literal);
|
const msg = this.unwrapCompressed();
|
||||||
|
const literal = msg.packets.findPacket(enums.packet.literal);
|
||||||
return (literal && literal.getBytes()) || null;
|
return (literal && literal.getBytes()) || null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -253,7 +254,8 @@ Message.prototype.getLiteralData = function() {
|
||||||
* @returns {(String|null)} filename of literal data packet as string
|
* @returns {(String|null)} filename of literal data packet as string
|
||||||
*/
|
*/
|
||||||
Message.prototype.getFilename = function() {
|
Message.prototype.getFilename = function() {
|
||||||
const literal = this.packets.findPacket(enums.packet.literal);
|
const msg = this.unwrapCompressed();
|
||||||
|
const literal = msg.packets.findPacket(enums.packet.literal);
|
||||||
return (literal && literal.getFilename()) || null;
|
return (literal && literal.getFilename()) || null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -262,7 +264,8 @@ Message.prototype.getFilename = function() {
|
||||||
* @returns {(String|null)} literal body of the message interpreted as text
|
* @returns {(String|null)} literal body of the message interpreted as text
|
||||||
*/
|
*/
|
||||||
Message.prototype.getText = function() {
|
Message.prototype.getText = function() {
|
||||||
const literal = this.packets.findPacket(enums.packet.literal);
|
const msg = this.unwrapCompressed();
|
||||||
|
const literal = msg.packets.findPacket(enums.packet.literal);
|
||||||
if (literal) {
|
if (literal) {
|
||||||
return literal.getText();
|
return literal.getText();
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,24 +168,10 @@ List.prototype.filterByTag = function (...args) {
|
||||||
/**
|
/**
|
||||||
* Traverses packet tree and returns first matching packet
|
* Traverses packet tree and returns first matching packet
|
||||||
* @param {module:enums.packet} type The packet type
|
* @param {module:enums.packet} type The packet type
|
||||||
* @returns {module:packet/packet|null}
|
* @returns {module:packet/packet|undefined}
|
||||||
*/
|
*/
|
||||||
List.prototype.findPacket = function (type) {
|
List.prototype.findPacket = function (type) {
|
||||||
const packetlist = this.filterByTag(type);
|
return this.find(packet => packet.tag === type);
|
||||||
if (packetlist.length) {
|
|
||||||
return packetlist[0];
|
|
||||||
}
|
|
||||||
let found = null;
|
|
||||||
for (let i = 0; i < this.length; i++) {
|
|
||||||
if (this[i].packets.length) {
|
|
||||||
found = this[i].packets.findPacket(type);
|
|
||||||
if (found) {
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user