socket.io-parser
Advanced tools
Comparing version 4.2.0 to 4.2.1
@@ -64,4 +64,12 @@ "use strict"; | ||
return data; | ||
if (data && data._placeholder) { | ||
return buffers[data.num]; // appropriate buffer (should be natural order anyway) | ||
if (data && data._placeholder === true) { | ||
const isIndexValid = typeof data.num === "number" && | ||
data.num >= 0 && | ||
data.num < buffers.length; | ||
if (isIndexValid) { | ||
return buffers[data.num]; // appropriate buffer (should be natural order anyway) | ||
} | ||
else { | ||
throw new Error("illegal attachments"); | ||
} | ||
} | ||
@@ -68,0 +76,0 @@ else if (Array.isArray(data)) { |
@@ -120,2 +120,5 @@ "use strict"; | ||
if (typeof obj === "string") { | ||
if (this.reconstructor) { | ||
throw new Error("got plaintext data when reconstructing a packet"); | ||
} | ||
packet = this.decodeString(obj); | ||
@@ -122,0 +125,0 @@ if (packet.type === PacketType.BINARY_EVENT || |
@@ -59,4 +59,12 @@ import { isBinary } from "./is-binary.js"; | ||
return data; | ||
if (data && data._placeholder) { | ||
return buffers[data.num]; // appropriate buffer (should be natural order anyway) | ||
if (data && data._placeholder === true) { | ||
const isIndexValid = typeof data.num === "number" && | ||
data.num >= 0 && | ||
data.num < buffers.length; | ||
if (isIndexValid) { | ||
return buffers[data.num]; // appropriate buffer (should be natural order anyway) | ||
} | ||
else { | ||
throw new Error("illegal attachments"); | ||
} | ||
} | ||
@@ -63,0 +71,0 @@ else if (Array.isArray(data)) { |
@@ -116,2 +116,5 @@ import { Emitter } from "@socket.io/component-emitter"; | ||
if (typeof obj === "string") { | ||
if (this.reconstructor) { | ||
throw new Error("got plaintext data when reconstructing a packet"); | ||
} | ||
packet = this.decodeString(obj); | ||
@@ -118,0 +121,0 @@ if (packet.type === PacketType.BINARY_EVENT || |
@@ -59,4 +59,12 @@ import { isBinary } from "./is-binary.js"; | ||
return data; | ||
if (data && data._placeholder) { | ||
return buffers[data.num]; // appropriate buffer (should be natural order anyway) | ||
if (data && data._placeholder === true) { | ||
const isIndexValid = typeof data.num === "number" && | ||
data.num >= 0 && | ||
data.num < buffers.length; | ||
if (isIndexValid) { | ||
return buffers[data.num]; // appropriate buffer (should be natural order anyway) | ||
} | ||
else { | ||
throw new Error("illegal attachments"); | ||
} | ||
} | ||
@@ -63,0 +71,0 @@ else if (Array.isArray(data)) { |
@@ -112,2 +112,5 @@ import { Emitter } from "@socket.io/component-emitter"; | ||
if (typeof obj === "string") { | ||
if (this.reconstructor) { | ||
throw new Error("got plaintext data when reconstructing a packet"); | ||
} | ||
packet = this.decodeString(obj); | ||
@@ -114,0 +117,0 @@ if (packet.type === PacketType.BINARY_EVENT || |
{ | ||
"name": "socket.io-parser", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"description": "socket.io protocol parser", | ||
@@ -5,0 +5,0 @@ "repository": { |
52726
1522