Merge pull request #5092 from GabrielInTheWorld/fixDecoding

Fixes decoding caused by exceeding stack size
This commit is contained in:
Sean 2019-10-30 11:21:11 +01:00 committed by GitHub
commit cc2dc1eeff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -545,8 +545,10 @@ export class WebsocketService {
* @param buffer - Buffer to convert
* @returns String
*/
private arrayBufferToString(buffer: ArrayBuffer): string {
return String.fromCharCode.apply(null, Array.from(new Uint16Array(buffer)));
private arrayBufferToString(buffer: Uint8Array): string {
return Array.from(buffer)
.map(code => String.fromCharCode(code))
.join('');
}
/**