You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Uncaught:
AssertionError[ERR_ASSERTION]: '1T+HJWDNyTa4jJXwoBbV6Q=='=='77+9P++/vSVg77+977+9Nu+/ve+/ve+/ve+/vRbvv73vv70='
at REPL37:1:8atScript.runInThisContext(vm.js:134:12)atREPLServer.defaultEval(repl.js:566:29)atbound(domain.js:421:15)atREPLServer.runBound[aseval](domain.js:432:12)atREPLServer.onLine(repl.js:909:10)atREPLServer.emit(events.js:412:35)atREPLServer.emit(domain.js:475:12)atREPLServer.Interface._onLine(readline.js:434:10)atREPLServer.Interface._line(readline.js:791:8){generatedMessage: true,code: 'ERR_ASSERTION',actual: '1T+HJWDNyTa4jJXwoBbV6Q==',expected: '77+9P++/vSVg77+977+9Nu+/ve+/ve+/ve+/vRbvv73vv70=',operator: '=='}
What's going on here? Well, it looks like the implementation for get always calls Buffer.toString() on values that were originally stored as buffers. This encodes the data returned as utf8, which breaks on bytes that don't have representation in unicode. From the node Buffer docs:
When decoding a Buffer into a string that does not exclusively contain valid UTF-8 data, the Unicode replacement character U+FFFD � will be used to represent those errors.
To bring this into compliance with ioredis, we likely need to change the getBuffer implementation to detect that a key was stored as a buffer and return it as such without interpretation. I think this will yield the same behavior as ioredis get and getBuffer.
Will send PR.
The text was updated successfully, but these errors were encountered:
Consider the following example:
Result:
What's going on here? Well, it looks like the implementation for
get
always callsBuffer.toString()
on values that were originally stored as buffers. This encodes the data returned as utf8, which breaks on bytes that don't have representation in unicode. From the node Buffer docs:To bring this into compliance with ioredis, we likely need to change the
getBuffer
implementation to detect that a key was stored as a buffer and return it as such without interpretation. I think this will yield the same behavior as ioredisget
andgetBuffer
.Will send PR.
The text was updated successfully, but these errors were encountered: